Gthreads again
- From: "Fernando Apesteguía" <fernando apesteguia gmail com>
- To: gtk-app-devel-list gnome org
- Subject: Gthreads again
- Date: Mon, 24 Apr 2006 20:14:56 +0200
And how to kill the gthread if there is not something like pthread_cancel?
(Thanks for your patience)
Best regards
---------- Forwarded message ----------
From: Tristan Van Berkom <tvb gnome org>
Date: 24-abr-2006 20:04
Subject: Re: Gthreads again
To: Fernando Apesteguía <fernando apesteguia gmail com>
Cc: gtk-app-devel-list gnome org
Fernando Apesteguía wrote:
The main thread is the only one that is running inside the gtk_main loop.
The secondary thread is only reading files. So if I do a gtk_main_quit()
the
secondary thread will be no longer running because I have not a gtk_main
loop, right?
Wrong, the main thread is not running inside the gtk_main loop, the
gtk_main is running inside an arbitrary thread (happens to be the
main one); if you call gtk_main_quit(); then gtk_main() (in the main
thread) will return and the main thread will continue to execute
(typicly untill the "return 0" a few lines later on).
If I'm right why I had to explicitly kill the other thread when it was
created with pthread instead of g_thread?
There is no reason why you dont have to explicitly kill the GThread,
if there is a race condition with your old code, there is still
a race in the GThread version.
Cheers,
-Tristan
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]