コード例 #1
0
ファイル: sync.c プロジェクト: mehulpatel696/cos318
/* Unblock the first thread waiting on c, if extant */
void condition_signal(condition_t * c)
{
  enter_critical();
  ASSERT(disable_count);
  unblock_one( &c->wait_queue );
  leave_critical();
}
コード例 #2
0
ファイル: sync.c プロジェクト: robertsami/COS318
static void lock_release_helper(lock_t * l){
  ASSERT(disable_count);
  if (!unblock_one(&l->wait_queue)) {
    l->status = UNLOCKED;
  }
  l->held_task = NULL;
  
}
コード例 #3
0
ファイル: sync.c プロジェクト: robertsami/COS318
/* TODO: Unblock the first thread waiting on c, if it exists */
void condition_signal(condition_t * c){
	// disable int
  enter_critical();

	// wake up
  unblock_one(&c->blocked);

	// enable int
  leave_critical();
}
コード例 #4
0
ファイル: sync.c プロジェクト: mehulpatel696/cos318
/* Increment the semaphore value atomically */
void semaphore_up(semaphore_t * s)
{
  enter_critical();

  if(s->value < 1 && !queue_empty(&s->wait_queue))
    unblock_one(&s->wait_queue);
  else
    s->value++;

  leave_critical();
}
コード例 #5
0
ファイル: sync.c プロジェクト: mehulpatel696/cos318
static void lock_release_helper(lock_t * l)
{
    ASSERT(disable_count);
    pcb_t *p = unblock_one(&l->wait_queue);
    if( p )
    {
      p->waiting_for_lock = NULL;
      l->owner = p;
    }
    else
    {
      l->owner = NULL;
    }

    l->status = UNLOCKED;
}
コード例 #6
0
ファイル: sync.c プロジェクト: robertsami/COS318
static void unblock_all(node_t * wait_queue){
  while (is_empty(wait_queue)==0){
    unblock_one(wait_queue);
  }
}
コード例 #7
0
ファイル: sync.c プロジェクト: robertsami/COS318
/* TODO: Increment the semaphore value atomically */
void semaphore_up(semaphore_t * s){
  enter_critical();
  if(s->val++ == 0)
    unblock_one(&s->wait_queue);
  leave_critical();
}
コード例 #8
0
ファイル: sync.c プロジェクト: ahimelman/project3
/* TODO: Increment the semaphore value atomically */
void semaphore_up(semaphore_t * s){
    enter_critical();
    if (!unblock_one(&s->wait_queue)) 
        ++s->value;
    leave_critical();  
}
コード例 #9
0
ファイル: sync.c プロジェクト: ahimelman/project3
/* TODO: Unblock the first thread waiting on c, if it exists */
void condition_signal(condition_t * c){
    enter_critical();
    unblock_one(&c->wait_queue);     
    leave_critical();
}
コード例 #10
0
ファイル: sync.c プロジェクト: mehulpatel696/cos318
static void unblock_all(node_t * wait_queue)
{
  while( unblock_one(wait_queue) )
    {}
}