Re: newby stupid syncronization question...
- From: Owen Taylor <otaylor redhat com>
- To: Mark Shinwell <mrs30 cam ac uk>
- Cc: DROUIN Antoine STNA 7SB K232 p5766 <drouin stna dgac fr>, gtk-list redhat com, recipient list not shown: ;
- Subject: Re: newby stupid syncronization question...
- Date: 23 Aug 1999 12:42:07 -0400
Mark Shinwell <mrs30@cam.ac.uk> writes:
> If you add a low-priority Gtk idle function using gtk_idle_add_priority()
> containing code like
>
> int signalled = 0;
>
> pthread_mutex_lock(&signal_mutex);
> if (signal_value == 1) {
> /* other thread has signalled */
>
> signal_value = 0;
> signalled = 1;
> }
> pthread_mutex_unlock(&signal_mutex);
>
> if (signalled) {
> /* do whatever is required */
>
> }
You'll eat CPU like crazy ;-) Low priority idle functions
just mean that they don't get run when there is anything
else to do. When there is _nothing_ else to do, they will
be run continually.
Regards,
Owen
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]