Re: gthread vs pthread

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

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

(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.)


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