Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.programming.threads > #3437

Re: Is mutex ownership handed off strictly only to threads which have requested for the lock prior to unlocking?

From Kaz Kylheku <221-501-9011@kylheku.com>
Newsgroups comp.programming.threads
Subject Re: Is mutex ownership handed off strictly only to threads which have requested for the lock prior to unlocking?
Date 2016-08-31 18:08 +0000
Organization Aioe.org NNTP Server
Message-ID <20160831110018.9@kylheku.com> (permalink)
References <e977edab-75c7-4d0c-92f2-5049cc37383f@googlegroups.com> <57c69442$0$939$e4fe514c@news.xs4all.nl> <9c335b95-c5ae-48b3-b6e8-e446a94e9124@googlegroups.com>

Show all headers | View raw


On 2016-08-31, Sibin Thomas <sibinpthomas@gmail.com> wrote:
> I was influenced by the discussion here - http://austingroupbugs.net/view.php?id=609
> I thought similar to pthread_signal() pthread_mutex_unlock() too does an "atomic unblock" of threads already in its 'Wait queue'

pthread_cond_{signal,broadcast} do not do any atomic unblock,
and can be invoked without the mutex being held.

The atomicity is in the pthread_cond_{wait,timedwait} operations. From
the application point of view, it appears that transition of from
"mutex owner" to "waiting on condition" is atomic. There is no
in-between window of time during which the signal or broadcast
could take place such that a thread is neither mutex owner,
nor waiting on the condition.

The signal/broadcast itself though is basically just a best effort:
whatever thread or threads, are actually waiting at the moment of the
call are woken up, and that's it.

Back to comp.programming.threads | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Is mutex ownership handed off strictly only to threads which have requested for the lock prior to unlocking? Sibin Thomas <sibinpthomas@gmail.com> - 2016-08-30 22:39 -0700
  Re: Is mutex ownership handed off strictly only to threads which have requested for the lock prior to unlocking? Casper H.S. Dik <Casper.Dik@OrSPaMcle.COM> - 2016-08-31 08:24 +0000
    Re: Is mutex ownership handed off strictly only to threads which have requested for the lock prior to unlocking? Sibin Thomas <sibinpthomas@gmail.com> - 2016-08-31 04:08 -0700
      Re: Is mutex ownership handed off strictly only to threads which have requested for the lock prior to unlocking? Casper H.S. Dik <Casper.Dik@OrSPaMcle.COM> - 2016-08-31 11:41 +0000
        Re: Is mutex ownership handed off strictly only to threads which have requested for the lock prior to unlocking? Sibin Thomas <sibinpthomas@gmail.com> - 2016-08-31 10:08 -0700
      Re: Is mutex ownership handed off strictly only to threads which have requested for the lock prior to unlocking? Kaz Kylheku <221-501-9011@kylheku.com> - 2016-08-31 18:08 +0000
        Re: Is mutex ownership handed off strictly only to threads which have requested for the lock prior to unlocking? Sibin Thomas <sibinpthomas@gmail.com> - 2016-09-01 03:50 -0700
  Re: Is mutex ownership handed off strictly only to threads which have requested for the lock prior to unlocking? Kaz Kylheku <221-501-9011@kylheku.com> - 2016-08-31 17:59 +0000

csiph-web