DragonFly bugs List (threaded) for 2006-07
Re: Threadding issue
On Thu, Jul 27, 2006 at 02:42:29PM +1000, Petr Janda wrote:
> Can someone please fix it? Its really bugging me, and Im not the only
> one to have that issue. Some people say growisofs does the same.
IIUC, libc_r's thread scheduler may call sys_set_tls_area() at most twice
per call, so if the application tries to switch between threads very
frequently, it can call sys_set_tls_area() very often. There are many
places in libc_r's code where the thread scheduler is called, but the
easiest way to make it happen is calling sched_yield().
For example, src/engine.c in gxine has the following code:
static gboolean js_queue_cb (GtkWidget *widget, GdkEventClient *event,
while ((js = g_async_queue_try_pop (js_queue)))
/* spin; play_exec gets this & the GDK lock in reverse order */
while (pthread_mutex_trylock (&widgets_update_lock))
pthread_mutex_unlock (&widgets_update_lock); /* JS 'play()' needs it */
engine_exec_obj (js->cmd, js->obj, js->cb, js->cb_data, js->ecb, js->src);
I wonder what happens if you use libthread_xu instead of libc_r
(not sure if it's easy to replace the use of pthead library).