Re: Sleeping thread not receive signal until it wakes up

From: Jan Engelhardt
Date: Wed Mar 07 2007 - 15:21:46 EST



On Mar 7 2007 08:19, linux-os (Dick Johnson) wrote:
>
>Later versions of the kernel lock the kernel when an ioctl() is
>entered. This means that if you sleep in the ioctl(), nothing
>will get scheduled.

Later versions of the kernel also have an ->unlocked_ioctl method,
which is probably better than below's approach [which is akin to
FreeBSD's DROP_GIANT/PICKUP_GIANT].

>You can do the following (possibly unsafe) in your ioctl():
>
> int locked = kernel_locked();
>
> ......... code
> ......... code
>
> if(locked) // Before sleeping section
> unlock_kernel();
> .......... sleeping code
> if(locked) // After sleeping section
> lock_kernel();
>
>

Jan
--
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/