Re: gthread vs pthread
- From: Tor Lillqvist <tml iki fi>
- To: gtk-app-devel-list gnome org
- Subject: Re: gthread vs pthread
- Date: Tue, 24 Jul 2007 02:32:35 +0300
Chris Vine writes:
If you know that the gthread implementation is a pthreads one (ie the
program is not running on Windows) there is absolutely no problem at all
in using pthreads in the program directly,
Also, there is a quite nice pthreads implementation even for
Windows: http://sourceware.org/pthreads-win32/
If you use pthreads, please be careful if you want portability. Don't
assume that pthread_t is a pointer type. It isn't necessarily. For
instance in pthreads-win32 and HP-UX it is a struct. You should treat
pthread_t as an opaque type you know nothing of. Don't compare
pthread_t values for equality except with pthread_equal(). Also, there
is no portable "uninitialized" pthread_t value. Use separate boolean
flags if necessary to tell whether a pthread_t has been initialized or
not.
(Anyway, please remember that calling GTK+ API from multiple threads
doesn't work on Windows. But using threads otherwise (creating them
using the GThreads, pthreads, or Microsoft's C library's API) works
fine in GLib-using programs on Windows.)
--tml
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]