[Meego-kernel] Error Handling for wait_for_completion_interruptible_timeout

Alan Cox alan at linux.intel.com
Wed Dec 1 05:10:31 PST 2010


On Tue, 30 Nov 2010 16:53:07 +0000
"Popescu, CatalinX" <catalinx.popescu at intel.com> wrote:

> I have a question regarding the synchronization mechanism
> wait_for_completion_interruptible_timeout. Sometimes, it just returns
> an ERESTARTSYS error because the scheduler detects a pending signal :
> TIF_SIGPENDING is set into thread_info. But looking at sigpending
> from task_struct there are no pending signals...

If the userspace is multi-threaded and using posix signals then it is
I suppose possible another thread handled a signal that went to a
thread group.

> What is the driver supposed to do when receiving ERESTARTSYS in
> general case? Is it supposed to return EAGAIN so the signal gets
> handled by user space?

That depends. If it makes more sense for it to restart the system call
then ERESTARTSYS may be what you want to return.

> In this particular case, when there are no real signals pending, is
> the driver allowed to call recalc_sigpending or any equivalent
> function in order to clear flag TIF_SIGPENDING and issue another call
> to wait_for_completion_interruptible_timeout (this time blocking) ?

I can't see a situation in which that should occur.


More information about the MeeGo-kernel mailing list