Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > C++ > Re: possibly ot...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 6 of 12 Topic 45875 of 48020
Post > Topic >>

Re: possibly ot: thread suspension

by James Kanze <james.kanze@[EMAIL PROTECTED] > May 13, 2008 at 02:15 AM

On May 13, 1:29 am, "Chris Thomasson" <cris...@[EMAIL PROTECTED]
> wrote:
> "Szabolcs Ferenczi" <szabolcs.feren...@[EMAIL PROTECTED]
> wrote in message

>
news:dd13a776-05a7-440f-9d3f-85e9be1f975b@[EMAIL PROTECTED]
> On May 12, 9:15 am, Chris Forone <4...@[EMAIL PROTECTED]
> wrote:

> > how does a thread suspend itself? is a volatile bool enough,
> > that is checked after each loop?

> [...]

> > If you want to check the return values of the library operations

> You must check the return values of pthread calls. IMVHO,
> applications that fail to at least check status of pthread
> calls are crap.

I more or less agree, but... What do you do if
pthread_mutex_lock() fails?  In many cases, the only possible
cause of failure will be a programming error elsewhere, or
insufficient resources.  In both cases, most of the time, about
all you can reasonably do is abort with an error message.

(You definitely do have to consider the case, of course.  If
pthread_mutex_lock() returns with an error, you do NOT have the
lock.)

> > your code will be even more complex.

> Why? You can wrap the raw API calls.

Generally, you should have anything at that low a level wrapped
in a class anyway.

--
James Kanze (GABI Software)             email:james.kanze@[EMAIL PROTECTED]
 en informatique orient=E9e objet/
                   Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34
 




 12 Posts in Topic:
possibly ot: thread suspension
Chris Forone <4one@[EM  2008-05-12 09:15:10 
Re: possibly ot: thread suspension
James Kanze <james.kan  2008-05-12 03:07:29 
Re: possibly ot: thread suspension
Gianni Mariani <gi4nos  2008-05-12 10:13:58 
Re: possibly ot: thread suspension
Szabolcs Ferenczi <sza  2008-05-12 08:45:39 
Re: possibly ot: thread suspension
"Chris Thomasson&quo  2008-05-12 16:29:18 
Re: possibly ot: thread suspension
James Kanze <james.kan  2008-05-13 02:15:38 
Re: possibly ot: thread suspension
"Chris Thomasson&quo  2008-05-13 13:10:49 
Re: possibly ot: thread suspension
James Kanze <james.kan  2008-05-14 01:33:03 
Re: possibly ot: thread suspension
"Chris Thomasson&quo  2008-05-14 02:41:01 
Re: possibly ot: thread suspension
Chris Forone <4one@[EM  2008-05-15 16:49:51 
Re: possibly ot: thread suspension
"Chris Thomasson&quo  2008-05-13 13:24:41 
Re: possibly ot: thread suspension
Chris Forone <4one@[EM  2008-05-15 16:49:06 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Tue Oct 14 8:47:50 CDT 2008.