Exemple #1
0
bool_t _wait_event (cond_t * c, bool_t i)
{
	bool_t res = 0;

	if (!cond_test (c)) {

		if (current == &task [0])
			panic ("task 0 waits condition %x", (int) c);

		wait_set ((struct wait_queue *) c);
		while (1) {
			current->state = i ? TASK_INTERRUPTIBLE : TASK_UNINTERRUPTIBLE;
			if (cond_test (c)) break;
			schedule ();

			if (i && current->signal)
			{
				// Interrupted by signal
				res = 1;
				break;
			}
		}

		current->state = TASK_RUNNING;
		wait_clear ((struct wait_queue *) c);
	}

	return res;
}
Exemple #2
0
static void __sleep_on(register struct wait_queue *p, __s16 state)
{
    register __ptask pcurrent = current;

    if (pcurrent == &task[0])
	panic("task[0] trying to sleep from %x", (int)p);
    pcurrent->state = state;
    wait_set(p);
    schedule();
    wait_clear(p);
}
Exemple #3
0
static void wait_on_inode(register struct inode *inode)
{
    register __ptask currentp = current;

    if (inode->i_lock) {
	wait_set(&inode->i_wait);
	currentp->state = TASK_UNINTERRUPTIBLE;
	while (inode->i_lock)
	    schedule();
	currentp->state = TASK_RUNNING;
	wait_clear(&inode->i_wait);
    }
}
Exemple #4
0
void wait_on_super(register struct super_block *sb)
{
    register __ptask currentp = current;

    if (sb->s_lock) {
	wait_set(&sb->s_wait);
	currentp->state = TASK_UNINTERRUPTIBLE;
	while (sb->s_lock)
	    schedule();
	currentp->state = TASK_RUNNING;
	wait_clear(&sb->s_wait);
    }
}
Exemple #5
0
static void wait_on_inode(register struct inode *inode)
{
    if (!inode->i_lock)
	return;

    wait_set(&inode->i_wait);
  repeat:
    current->state = TASK_UNINTERRUPTIBLE;
    if (inode->i_lock) {
	schedule();
	goto repeat;
    }
    wait_clear(&inode->i_wait);
    current->state = TASK_RUNNING;
}
Exemple #6
0
void wait_on_buffer(register struct buffer_head *bh)
{
    if (buffer_locked(bh)) {

	bh->b_count++;

	wait_set(&bh->b_wait);

	goto chk_buf;
	do {
	    current->state = TASK_UNINTERRUPTIBLE;
	    schedule();
	    current->state = TASK_RUNNING;
    chk_buf:
	    ;
	} while(buffer_locked(bh));

	wait_clear(&bh->b_wait);
	bh->b_count--;
    }
}