Re: Delay time to spawn new threads?



On 11/27/2013 08:29 AM, David Buchan wrote:
I have written a program which spawns a new thread when the user
clicks a button. The new thread does something noticeable immediately
after starting, so I know when the thread has begun. What I mean is,
if I run that piece of code that is executed as a new thread, but as
a stand-alone program, it does it's thing immediately.

However, when I have it run as a new thread when the user clicks a
button, it takes about 1.5 seconds before it does its thing.


I've done this with g_thread_create() and g_thread_new() with
identical results. Is it normal for there to be a 1.5 sec delay, or
have I bumbled something?

Did you initialize the thread subsystem before using threads?  Did you
use the proper semiphores around GUI calls, or better yet use g_idle_add
to schedule GUI updates in the main thread?

http://www.gtk.org/api/2.6/gdk/gdk-Threads.html
http://blog.borovsak.si/2009/06/multi-threaded-gtk-applications.html
etc


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]