[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: threading
- From: Bryan Wilkinson <nardo pobox com>
- To: "GTK+ App Developer's Mailing List." <gtk-app-devel-list redhat com>
- Subject: Re: threading
- Date: Thu, 10 Jun 1999 04:02:23 -0400 (EDT)
in my multithreaded app, rather than call gtk_main(), i use the following
code:
while(1)
{
pthread_mutex_lock(draw_mutex);
while(gtk_events_pending())
{
gtk_main_iteration();
}
pthread_mutex_unlock(draw_mutex);
sleep(0);
}
and the other threads all call pthread_mutex_lock(draw_mutex) before any
gtk functions, and pthread_mutex_unlock(draw_mutex) afterward. the main
thing to watch out for is having one of your callback functions call
pthread_mutex_lock(draw_mutex) because the callbacks are executed inside
of gtk_main_iteration and the mutex is therefore already locked.
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]