示例#1
0
/*===========================================================================*
 *				lock_bsf				     *
 *===========================================================================*/
void lock_bsf(void)
{
  struct worker_thread *org_self;

  if (mutex_trylock(&bsf_lock) == 0)
	return;

  org_self = worker_suspend();

  if (mutex_lock(&bsf_lock) != 0)
	panic("unable to lock block special file lock");

  worker_resume(org_self);
}
示例#2
0
/*===========================================================================*
 *				lock_proc				     *
 *===========================================================================*/
void lock_proc(struct fproc *rfp)
{
  int r;
  struct worker_thread *org_self;

  r = mutex_trylock(&rfp->fp_lock);
  if (r == 0) return;

  org_self = worker_suspend();

  if ((r = mutex_lock(&rfp->fp_lock)) != 0)
	panic("unable to lock fproc lock: %d", r);

  worker_resume(org_self);
}
示例#3
0
文件: dmap.c 项目: Hooman3/minix
/*===========================================================================*
 *				lock_dmap		 		     *
 *===========================================================================*/
void lock_dmap(struct dmap *dp)
{
/* Lock a driver */
	struct worker_thread *org_self;
	int r;

	assert(dp != NULL);
	assert(dp->dmap_driver != NONE);

	org_self = worker_suspend();

	if ((r = mutex_lock(&dp->dmap_lock)) != 0)
		panic("unable to get a lock on dmap: %d\n", r);

	worker_resume(org_self);
}