Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail From: Alexander Terekhov Newsgroups: comp.programming.threads Subject: Re: can pthread_mutex_trylock() give up the timeslice? Date: Sat, 15 Oct 2011 13:53:48 +0200 Organization: A noiseless patient Spider Lines: 20 Message-ID: <4E99744C.36B91DCA@web.de> References: <996e61f0-62c3-4960-9f1f-3926af713c34@b41g2000yqd.googlegroups.com> <0e75e91b-526a-48d3-900c-f5a9a4315e4e@b41g2000yqd.googlegroups.com> Reply-To: terekhov@web.de Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Injection-Info: mx04.eternal-september.org; posting-host="MCbSEzW5qwGLFMNXJh39IQ"; logging-data="11984"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+syWEAAw4IdYr7WLf6xNYABXVx5oa8zaM=" X-Mailer: Mozilla 4.77 [en] (Windows NT 5.0; U) X-Accept-Language: en Cancel-Lock: sha1:QG9wjUrmKE4oNoOGyyFCvAGIJ0Y= Xref: x330-a1.tempe.blueboxinc.net comp.programming.threads:636 Brendon wrote: [...] > My plan now will be just to go along and do the work using a try-lock > (not a huge change) if it shows some issues then look at another > solution. I just wanted to ask and see if anyone here has heard of > pthread_mutex_trylock() prematurely giving up a timeslice and so far Realtime aside, implementations of pthread_mutex_trylock() are allowed to give up a time slice. If you really think that that is a problem for your code then use C/C++ atomics to implement your own mutex with trylock() not giving up a timeslice: http://lists.boost.org/Archives/boost/2004/05/65435.php (auto_reset_event is a binary semaphore in posix speak) regards, alexander.