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 > Programming Threads > Re: Understandi...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 8 of 16 Topic 4059 of 4146
Post > Topic >>

Re: Understanding pthread_cond_wait()

by "Chris M. Thomasson" <no@[EMAIL PROTECTED] > Sep 29, 2008 at 04:59 AM

"Szabolcs Ferenczi" <szabolcs.ferenczi@[EMAIL PROTECTED]
> wrote in message 
news:e2f3e0ea-83c8-477e-b9cb-eacf4467b61e@[EMAIL PROTECTED]
> On Sep 27, 4:28 am, "lancer6...@[EMAIL PROTECTED]
" <lancer6...@[EMAIL PROTECTED]
>
> wrote:
>> Hi all,
>>
>> I would like to know if my understanding on how the program handles
>> pthread_cond_wait() and pthread_cond_signal() is correct.
>>
>> Given the code below,
>>
>> // Thread A
>> while (1)
>> {
>>    do_Awork();
>>    signal = 1;
>>    pthread_cond_signal(&condition);
>>    signal = 0;
>>
>> }
>>
>> // Thread B, C, D
>> while (1)
>> {
>>    pthread_mutex_lock(&mutex);
>>    while (!signal)
>>       pthread_cond_wait(&condition, &mutex);
>>    do_BCDwork();
>>    pthread_mutex_unlock(&mutex);
>>
>> }
>
> When you consider using condition variables, it always helps you if
> you know about the condition variable test:
>
http://groups.google.com/group/comp.programming.threads/browse_frm/thread/0ff7ac10adadee22

Forget that sack of crap! Use Relacy:

http://groups.google.ru/group/relacy/web

It works. Any questions?

:^|

[...]
 




 16 Posts in Topic:
Understanding pthread_cond_wait()
"lancer6238@[EMAIL P  2008-09-26 19:28:05 
Re: Understanding pthread_cond_wait()
"Chris M. Thomasson&  2008-09-26 21:19:14 
Re: Understanding pthread_cond_wait()
"lancer6238@[EMAIL P  2008-09-27 04:30:53 
Re: Understanding pthread_cond_wait()
Markus Elfring <Markus  2008-09-28 08:50:09 
Re: Understanding pthread_cond_wait()
"Chris M. Thomasson&  2008-09-28 14:33:19 
Re: Understanding pthread_cond_wait()
Szabolcs Ferenczi <sza  2008-09-28 04:26:13 
Re: Understanding pthread_cond_wait()
"Chris M. Thomasson&  2008-09-28 13:44:24 
Re: Understanding pthread_cond_wait()
"Chris M. Thomasson&  2008-09-29 04:59:37 
Re: Understanding pthread_cond_wait()
Szabolcs Ferenczi <sza  2008-09-28 13:56:49 
Re: Understanding pthread_cond_wait()
"Chris M. Thomasson&  2008-09-28 14:17:14 
Re: Understanding pthread_cond_wait()
Szabolcs Ferenczi <sza  2008-09-28 14:23:59 
Re: Understanding pthread_cond_wait()
"Chris M. Thomasson&  2008-09-28 14:38:36 
Re: Understanding pthread_cond_wait()
"Chris M. Thomasson&  2008-09-28 14:46:34 
Re: Understanding pthread_cond_wait()
"Chris M. Thomasson&  2008-09-28 14:49:40 
Re: Understanding pthread_cond_wait()
"lancer6238@[EMAIL P  2008-09-28 18:01:33 
Re: Understanding pthread_cond_wait()
"Chris M. Thomasson&  2008-09-30 03:31:51 

Post A Reply:
  Go here to Signup

AddThis Feed Button


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

Contact
tan12V112 Sat Nov 22 8:09:27 CST 2008.