Conditional waits
lambert54_at_cox.net
Date: 09/28/05
- Next message: aix_at_mail.com: "Re: Determining physical processors on SMT driven architectures"
- Previous message: Tom Roggeveen: "Re: Inexpensive, good gigabit ethernet NIC?"
- Next in thread: lambert54_at_cox.net: "Re: Conditional waits"
- Reply: lambert54_at_cox.net: "Re: Conditional waits"
- Reply: Paul Pluzhnikov: "Re: Conditional waits"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 28 Sep 2005 13:03:08 -0700
If I defined global vars as:
1) pthread_mutex_t CtrlThrdSem = PTHREAD_MUTEX_INITIALIZER;
2) pthread_cond_t CtrlThrdCond = PTHREAD_COND_INITIALIZER;
have my main thread basically doing:
3) pthread_mutex_lock ( &CtrlThrdSem );
4) ... start thread, do stuff ...
5) time(&timebuf.tv_sec);
6) timebuf.tv_sec += HA_CTRLTHRD_TIMEOUT;
7) timebuf.tv_nsec = 0L;
8) pthread_cond_timedwait(&CtrlThrdCond, &CtrlThrdSem, &timebuf);
and another thread doing:
9) pthread_cond_signal ( &CtrlThrdCond );
What will happen if line 9 gets performed before line 8 is called?
Shouldn't it just drop on through the call or is there a possiblity of
not picking up the condition?
- Next message: aix_at_mail.com: "Re: Determining physical processors on SMT driven architectures"
- Previous message: Tom Roggeveen: "Re: Inexpensive, good gigabit ethernet NIC?"
- Next in thread: lambert54_at_cox.net: "Re: Conditional waits"
- Reply: lambert54_at_cox.net: "Re: Conditional waits"
- Reply: Paul Pluzhnikov: "Re: Conditional waits"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]