Commit Graph

74 Commits

Author SHA1 Message Date
Matthias Clasen
adf892e96a Annotate all examples with their language
The C ones, at least.
2014-02-01 15:11:49 -05:00
Matthias Clasen
77c4ff80dc docs: Stop using the function tag 2014-02-01 12:19:04 -05:00
Matthias Clasen
17f51583a8 Docs: Convert examples to |[ ]| 2014-01-31 21:56:33 -05:00
Matthias Clasen
c575d24dfb Docs: Don't use the note tag
More markup avoidance.
2014-01-31 18:20:06 -05:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Stef Walter
c9cfa7d1d5 gthread-posix: Don't use gslice allocated GRecMutex
This leads to problems during cleanup, and seems strange
to have locks defined in terms of things that need locking.

https://bugzilla.gnome.org/show_bug.cgi?id=711753
2013-11-26 20:23:48 +01:00
Dan Winship
3981cddbf8 Require POSIX.1 (1990) compliance on unix
Assume unix platforms support the original POSIX.1 standard.
Specifically, assume that if G_OS_UNIX, then we have chown(),
getcwd(), getgrgid(), getpwuid(), link(), <grp.h>, <pwd.h>,
<sys/types.h>, <sys/uio.h>, <sys/wait.h>, and <unistd.h>.

Additionally, since all versions of Windows that we care about also
have <sys/types.h>, we can remove HAVE_SYS_TYPES_H checks everywhere.

Also remove one include of <sys/times.h>, and the corresponding
configure check, since the include is not currently needed (and may
always have just been a typo for <sys/time.h>).

https://bugzilla.gnome.org/show_bug.cgi?id=710519
2013-11-20 09:17:42 -05:00
Sebastian Dröge
dbdfcb69ce gthread: Use pthread_cond_timedwait_monotonic() if available
Otherwise we have to rely on pthread_cond_timedwait() actually using
the monotonic clock, which might be true or not. On Android at least
it is using the realtime clock, no pthread_condattr_setclock() is available
but instead pthread_cond_timedwait_monotonic() can be used.
2013-07-04 10:41:59 +02:00
Ryan Lortie
3cefb7248a Revert two errant commits to GMutex, etc.
This reverts commits dfbac178bd and
56348210f3.

These two commits introduce undesirable behaviour and were made with no
apparent approval from anybody at all, and without reference to a bug or
mailing list discussion.
2013-07-01 23:30:47 -04:00
Jeffrey Stedfast
dfbac178bd Finish the previous fix for GMutex, GRecMutex, GRWLock and GCond 2013-06-30 14:02:38 -04:00
Jeffrey Stedfast
56348210f3 Fixed g_mutex_clear() to fully undo g_mutex_init()
In order to fully undo the effects of g_mutex_init(),
it is necessary to reset the internal mutex pointer
back to NULL so that a later call to g_mutex_init()
actually works as expected.
2013-06-30 13:46:28 -04:00
Руслан Ижбулатов
2ca9dda72a win32: Allow POSIX threads to be used if --with-threads=posix
All tests pass with this patch AND a good pthreads implementation
(i'm using winpthreads, not pthreads-w32).

https://bugzilla.gnome.org/show_bug.cgi?id=697626
2013-04-09 14:10:13 +02:00
Matthias Clasen
e478b65ea5 Improve g_cond_wait docs
Document that the mutex is locked upon return.
https://bugzilla.gnome.org/show_bug.cgi?id=691110
2013-01-04 08:28:13 -05:00
Colin Walters
67466b41af build: Don't use C99 declarations
Since GLib needs to compile with MSVC, we can't use them.  This fixes
compilation when using -Werror=declaration-after-statement.

https://bugzilla.gnome.org/show_bug.cgi?id=687385
2012-11-01 20:12:01 -04:00
Ryan Lortie
311e18abdd gthread-posix: always use atomic pointer ops
On platforms where dependent loads can be reordered (alpha) and we have
exotic implementation of pthread_mutex_lock() it could be possible that
our implementation of g_mutex_lock() is unsafe.

Always use atomic operations to avoid this possibility.

https://bugzilla.gnome.org/show_bug.cgi?id=686191
2012-10-29 16:18:10 +01:00
Matthias Clasen
b7d1518ce9 Fix a typo in a doc comment 2012-08-28 00:08:07 -04:00
Matthias Clasen
23a2136fb5 Check for PR_SET_NAME
Bug 680148 claims that PR_SET_NAME may not be defined when
using an old kernel. Deal with it.
2012-07-19 06:37:59 -04:00
Antoine Jacoutot
829db4cec3 gthread-posix: fix typo in error message 2012-03-31 22:48:42 +02:00
Dan Winship
98a70df486 gthread-posix: fix order of arguments in g_thread_abort() message 2012-02-22 11:38:43 -05:00
Ravi Sankar Guntur
7486cd946a comments/docs: Fix couple of typos
https://bugzilla.gnome.org/show_bug.cgi?id=668857
2012-01-28 07:52:56 +01:00
Patrick Welche
decac50c15 Protect call to pthread_condattr_setclock with define.
While here update pthread_attr_setstacksize test to use AC_LINK_IFELSE
and avoid an unused variable in glib/tests/thread.c.

https://bugzilla.gnome.org/show_bug.cgi?id=667790
2012-01-15 23:41:27 -05:00
Jasper St. Pierre
d141940bc6 gthread-posix: Remove misleading documentation comments
g_thread_init() has done nothing since 2.32, so while the function
still can be used if "g_thread_init() has not yet been called",
it won't do nothing in that case, it will just perform normally.
2012-01-06 14:41:08 -05:00
Stef Walter
7e92997539 documentation fixes
Fixes for gtk-doc warnings.

http://bugzilla.gnome.org/show_bug.cgi?id=66469

https://bugzilla.gnome.org/show_bug.cgi?id=664699
2011-12-13 23:01:51 -05:00
Ryan Lortie
4033c616ff GCond: use monotonic time for timed waits
Switch GCond to using monotonic time for timed waits by introducing a
new API based on monotonic time in a gint64: g_cond_wait_until().

Deprecate the old API based on wallclock time in a GTimeVal.

Fix up the gtk-doc for GCond while we're at it: update the examples to
use static-allocated GCond and GMutex and clarify some things a bit.
Also explain the rationale behind using an absolute time instead of a
relative time.
2011-10-13 23:44:17 -04:00
Ryan Lortie
becb4b820f remove 'joinable' parameter to backends
Both backends are now oblivious to the concept of joinability, so don't
bother passing the parameter.
2011-10-13 00:01:28 -04:00
Ryan Lortie
dbf20d585f posix threads: joinable tweaks
Make the POSIX backend a little bit more like the win32 one in terms of
how we deal with joinability.

Calling g_system_thread_join() is now optional, and
g_system_thread_wait() can be safely called by multiple threads.

There is no longer any internal concept of joinability.
2011-10-12 23:40:02 -04:00
Ryan Lortie
2010f7f955 posix threads: use our own system_thread
Wrap GRealThread in a GThreadPosix that includes its own pthread_t field
called "system_thread" and use that instead of the generic field in
GRealThread.
2011-10-12 22:43:22 -04:00
Ryan Lortie
2f5486f020 thread creation: Simplify error handling
Instead of always returning non-NULL and finding out about errors via
the GError*, return NULL from the backend in the event of an error.
2011-10-12 22:43:22 -04:00
Ryan Lortie
e14a3746db Combine g_sytem_thread_{new,create}() 2011-10-12 22:43:22 -04:00
Ryan Lortie
a3f82c847f g_system_thread_create: drop 'data' arg
Since it's now always the same as the 'thread' arg.
2011-10-12 22:43:22 -04:00
Ryan Lortie
3237eaf5d5 g_system_thread_create: SystemThread -> RealThread
Just like g_system_thread_wait().
2011-10-12 22:43:22 -04:00
Ryan Lortie
dc3727cc5f g_system_thread_join: rename to _wait() 2011-10-12 22:15:46 -04:00
Ryan Lortie
4bb968e335 g_system_thread_join: take GRealThread *
Make g_system_thread_join take the GRealThread* instead of a
GSystemThread.
2011-10-12 22:14:38 -04:00
Ryan Lortie
e064c9bfec thread: delegate allocation of GThread to backends
Add g_system_thread_new() and g_system_thread_free(), implemented with
GSlice.  Use those instead of g_new() and g_free().

Presently, the backends are both doing the same thing.  This will change
soon.
2011-10-12 22:04:39 -04:00
Ryan Lortie
39ae59c47e thread: Delete g_system_thread_self()
It's no longer used for anything at all.
2011-10-12 18:35:45 -04:00
Ryan Lortie
47e20ed3ac thread: remove GSystemThread assign/equal
These are no longer in use.
2011-10-12 18:24:48 -04:00
Ryan Lortie
94b7d2ee6c Cleanup thread documentation 2011-10-06 12:01:53 -04:00
Matthias Clasen
fa6710ab6f Documentation fixes 2011-10-02 23:43:45 -04:00
Matthias Clasen
65b84bb7d0 Fix doc build
The markup here was not only broken, it was also unnecessary,
since gtk-doc knows to apply <function></function> tags to things
that end with () already.
2011-10-02 23:43:45 -04:00
Ryan Lortie
c5634df6d3 locks: change the ABI just a bit
Add a little bit more room in the ABI for our synchronisation primatives
since we're going to need it when we add native implementations on
Linux.

Also: rename the pointer field and add /*< private >*/ annotations.
2011-10-02 22:33:11 -04:00
Ryan Lortie
2a677d1370 locks: drop _INIT macros
All locks are now zero-initialised, so we can drop the G_*_INIT macros
for them.

Adjust various users around GLib accordingly and change the docs.

https://bugzilla.gnome.org/show_bug.cgi?id=659866
2011-10-02 22:33:10 -04:00
Ryan Lortie
e081eadda5 GThread posix: switch to Windows ABI
Modify the POSIX implementation of the synchronisation primatives to use
the same ABI as Windows: one pointer for each type.

This frees us from having to #include <pthread.h> and avoids the problem
with pthread_rwlock_t not being defined under certain compiler defines.

A few more changes are expected to the ABI -- they will be committed
separately.

https://bugzilla.gnome.org/show_bug.cgi?id=659866
2011-10-02 22:33:10 -04:00
Matthias Clasen
1909d2398a Make thread names useful in a debugger
Associate the name with the system thread, so that debuggers
can see it. This is currently only implemented for Linux, using
prctl.

https://bugzilla.gnome.org/show_bug.cgi?id=660635
2011-10-02 22:11:58 -04:00
Ryan Lortie
cdd43d43c9 locks: rename a bunch of parameters 2011-10-02 20:24:18 -04:00
Ryan Lortie
8e43470c38 Stop dithering over GPrivate
Take out the half-private g_private_init() stuff and replace it with a
G_PRIVATE_INIT macro that allows specifying a GDestroyNotify.

Expose the GPrivate structure in a public header.

Add a g_private_replace() to (sort of) match the functionality of
g_static_mutex_set().

Improve the documentation.

Deprecate g_private_new().
2011-10-02 20:04:03 -04:00
Matthias Clasen
900c467fd0 Move GThread docs around 2011-09-25 01:01:00 -04:00
Matthias Clasen
db04f59780 Move includes to the top of the file 2011-09-25 01:01:00 -04:00
Matthias Clasen
d6b0af99d7 GThread doc additions 2011-09-24 19:01:02 -04:00
Matthias Clasen
d4d203e3cb Fix g_rwlock_{writer,reader}_trylock 2011-09-22 22:45:47 -04:00
Matthias Clasen
9de564bf1f Fix g_rec_mutex_trylock 2011-09-22 21:58:55 -04:00