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


Groups > comp.programming.threads > #636

Re: can pthread_mutex_trylock() give up the timeslice?

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 <terekhov@web.de>
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> (permalink)
References <996e61f0-62c3-4960-9f1f-3926af713c34@b41g2000yqd.googlegroups.com> <0e75e91b-526a-48d3-900c-f5a9a4315e4e@b41g2000yqd.googlegroups.com> <b5165308-724e-404d-9859-dcbdd8c8fe24@l10g2000pra.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

Show key headers only | View raw


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.

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


Thread

can pthread_mutex_trylock() give up the timeslice? Brendon <brendon.j.costa@gmail.com> - 2011-10-13 16:05 -0700
  Re: can pthread_mutex_trylock() give up the timeslice? Alexander Terekhov <terekhov@web.de> - 2011-10-14 11:50 +0200
  Re: can pthread_mutex_trylock() give up the timeslice? Joshua Maurice <joshuamaurice@gmail.com> - 2011-10-14 13:43 -0700
    Re: can pthread_mutex_trylock() give up the timeslice? Brendon <brendon.j.costa@gmail.com> - 2011-10-14 16:56 -0700
      Re: can pthread_mutex_trylock() give up the timeslice? Alexander Terekhov <terekhov@web.de> - 2011-10-15 13:53 +0200
  Re: can pthread_mutex_trylock() give up the timeslice? David Schwartz <davids@webmaster.com> - 2011-10-15 21:41 -0700

csiph-web