Re: Usage of Semaphore with a workqueue

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello mulyadi,

Thanks for replying, sorry for late response comments are inline below

On Wed, Apr 1, 2009 at 10:14 PM, Mulyadi Santosa
<mulyadi.santosa@xxxxxxxxx> wrote:
> Hi
>
> On Wed, Apr 1, 2009 at 10:12 PM, Devesh Sharma <devesh28@xxxxxxxxx> wrote:
>> Hello list,
>>
>> Consider a case where I have a workqueue, a work is submitted to a it
>> from some interrupt handler
>> Lets say, some where in a code, it tries to get some semaphore to
>> enter into a critical section,
>> and fails to get it, sholud I still return from the work function by
>> returning ERESTARTSYS?
>> Kindly somebody clarify this to me
>
> To the best I know, when you fail to get semaphore, your code path
> will be blocked. Since you use workqueue which is able to sleep
> safely, I think you don't need to return ERESTARTSYS. The workqueue
> will sleep and try to reacquire the semaphore.
Do you mean there will not be any difference if I use
down_interruptible() or down() because
in workqueue context there is no way to send signal hence both will be
equivalant? So one must be careful
while designing semaphore/mutexs+workqueue because it can lead it to
infinite sleep?
>
> regards,
>
> Mulyadi.
>

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux