Threadding issue

Petr Janda elekktretterr at exemail.com.au
Thu Jul 27 05:06:42 PDT 2006


1) I can bzip the whole ktrace dump and put it on my webserver, will 
that help you?
2) How do i switch to libthread_xu?

Petr

YONETANI Tomokazu wrote:
On Thu, Jul 27, 2006 at 02:42:29PM +1000, Petr Janda wrote:
  
http://leaf.dragonflybsd.org/mailarchive/users/2006-07/msg00184.html

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,
																gpointer data)
		{
			exec_t *js;
			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))
					sched_yield ();
				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);
				free (js->cmd);
				free (js->src);
				free (js);
			}
			return TRUE;
		}
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).
  






More information about the Bugs mailing list