Re: semaphore ownership

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

 



On Sat, Mar 21, 2009 at 12:36 AM, Shyam Burkule <shyam.burkule@xxxxxxxxx> wrote:
>
>
> On Sat, Mar 21, 2009 at 12:24 AM, Daniel Baluta <daniel.baluta@xxxxxxxxx>
> wrote:
>>
>> On Fri, Mar 20, 2009 at 8:30 PM, Shyam Burkule <shyam.burkule@xxxxxxxxx>
>> wrote:
>> > Hello All,
>> >
>> >           Is it possible to take semaphore in one thread and release it
>> > in
>> > another thread?
>> >
>> > Thanks
>> > Shyam
>> >
>>
>> Hello ,
>>
>> Of course it is possible as long as you have a reference to the semaphore.
>>
>> But be aware that the usage of semaphores is advisory , and it depends
>> on you to implement a good functionality.
>>
>> thanks,
>> Daniel.
>
>
> Hi Daniel,
> Thanks for reaply..
>
>         Actually I was reading about synchronization mechanism in Linux ans
> Windows. So same case is applicable to mutex as well. I mean it possible to
> take mutex one thread and release it in another thread.

No, you can't do that with mutexes. If you release the mutex from any
other thread then behaviour is undefined and depends on OS.

Thanks -
Manish

> But in Windows there
> is mutex ownership concept, meaning thread which takes mutex has to release
> it. So if some thread release mutex, which is held by another thread then
> there wont be mutual exclusive access to shared data  protected by mutex in
> that thread.
>
>
> Sorry for silly question :).
>
>
> Thanks
> Shyam
>
>
>
> Thanks
>     Shyam
>

--
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