summaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2011-10-15Add tests for new g_environ_ functionsMatthias Clasen1-2/+60
2011-10-15Move environment-related functions into their own filesMatthias Clasen5-624/+30
gutils.[hc] is a bit of a grab bag, so lets start cleaning things up by moving all the environment-related functions into separate genviron.[hc] files. The private _g_getenv_nomalloc has been moved to its sole caller.
2011-10-15gutils: Add functions for working with environment arraysDan Winship5-48/+225
When spawning a child process, it is not safe to call setenv() before the fork() (because setenv() isn't thread-safe), but it's also not safe to call it after the fork() (because it's not async-signal-safe). So the only safe way to alter the environment for a child process from a threaded program is to pass a fully-formed envp array to exec*/g_spawn*/etc. So, add g_environ_getenv(), g_environ_setenv(), and g_environ_unsetenv(), which act like their namesakes, but work on arbitrary arrays rather than working directly on the environment. http://bugzilla.gnome.org/show_bug.cgi?id=659326
2011-10-15Add to the pitfalls: fork() and daemon()Ryan Lortie1-0/+12
2011-10-15tests/Makefile.am: remove unused LDFLAGS variableRyan Lortie1-1/+0
2011-10-15Expand thread docs a bitMatthias Clasen1-5/+38
Add some discussion of pitfalls of threaded programming.
2011-10-15Documentation tweaksMatthias Clasen1-25/+41
2011-10-15Updaged Galician translationsFran Dieguez1-402/+422
2011-10-15Check for "our" threads in some placesRyan Lortie1-3/+17
Don't allow g_thread_join() to be called on or g_thread_exit() to be called from within threads that were not created by GLib. Document this.
2011-10-15gtk-doc g_thread_ref() and g_thread_unref()Ryan Lortie1-0/+18
2011-10-15Rename g_thread_try to g_thread_try_newRyan Lortie6-15/+15
2011-10-15Add atomic test to TEST_PROGSMatthias Clasen1-2/+2
2011-10-15Documentation additionsMatthias Clasen1-0/+2
2011-10-15Improve test coverageMatthias Clasen3-2/+74
2011-10-14Add a test involving g_thread_ref/unrefMatthias Clasen1-2/+15
Also, fix the resource-limit test to properly unset RLIMIT_NPROC.
2011-10-14Add g_thread_try to the docsMatthias Clasen1-0/+1
2011-10-14Update doc listsMatthias Clasen1-2/+3
2011-10-14Minor doc clarificationsMatthias Clasen1-6/+7
2011-10-14Mention thread API changes in READMERyan Lortie1-2/+11
2011-10-14I read the news today, oh boy...Ryan Lortie1-0/+201
2011-10-14Stop checking for fork() across GMainContextRyan Lortie1-14/+0
01ed78d525cf2f8769022e27cc2573ec7ba123b3 introduced assertion checks for creating a main context, forking, and attempting to use the main context from the child side of the fork. Some code (such as gnome-keyring-daemon) daemonise after calling GMainContext. That's probably still mostly safe since we still only have one side of the fork touching the context afterwards. This use case is still troubling, however, since if any worker threads have been created at the time of the fork(), we could end up in the classic situation of leaving some mutexes in a locked state when the other threads disappear from the copy of the image that the child gets. This will require some deeper thinking...
2011-10-14Mask all signals in GLib worker threadRyan Lortie2-0/+26
Some code using GLib (gnome-keyring-daemon, for example) assumes that they can catch signals by masking them out in the main thread and calling sigwait() from a worker. The problem is that our new worker thread catches the signals before sigwait() has a chance and the default action occurs (typically resulting in program termination). If we mask all the signals in our worker, then this can't happen.
2011-10-14desktop-app-info: Add support for X-GNOME-KeywordsFlorian Müllner4-0/+24
With search gaining traction as being the preferred way to locate applications, the existing .desktop file fields meant for browsing often produce insufficient results. gnome-control-center introduced a custom X-GNOME-Keywords field for that purpose, which we plan to support in gnome-shell as well. https://bugzilla.gnome.org/show_bug.cgi?id=661763
2011-10-14g_cond_timed_wait: support NULL time parameterRyan Lortie1-0/+6
It was undocumented, but this used to mean "wait forever". Looks like we have some uses of this internally and there may be others in the wild...
2011-10-13GCond: use monotonic time for timed waitsRyan Lortie8-120/+167
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-13tests: disable deprecation warnings for testsRyan Lortie3-2/+5
We need to test deprecated functions, so don't warn us for doing so.
2011-10-13gutils: stop using GStaticPrivateRyan Lortie1-3/+3
This was our last internal use.
2011-10-13Revert "make struct _GThread private"Ryan Lortie2-9/+9
This reverts commit d904612100120d12126f1a6623a106d8a5b02fa6. glibmm touches the contents of GThread, so this broke their build.
2011-10-13make struct _GThread privateRyan Lortie2-9/+9
Hide the definition of struct _GThread in gthreadprivate.h for now. This is possibly an API break -- although the structure contents were undocumented and it was not safe to access them in a meaningful way, someone may have tried to do it anyway. We'll leave it here for a while to see if it causes any problems. Avoid merging its contents with GRealThread for now, just incase we need to expose it again.
2011-10-13tidy up gthreadprivate.hRyan Lortie2-23/+18
Remove some unused includes, too.
2011-10-13drop g_thread_new_full()Ryan Lortie6-57/+10
We'll hold out on this until someone has a really convincing reason for why they need to control the stack size. If we do decide to add it back, it should probably have a name like _new_with_stack_size(), not _full().
2011-10-13g_thread_new: never failRyan Lortie26-87/+73
Remove the GError argument from g_thread_new() and abort on failure. Introduce g_thread_try() for those who want to handle failure.
2011-10-13thread: nuke the concept of 'joinable'Ryan Lortie27-92/+87
And remove the 'joinable' argument from g_thread_new() and g_thread_new_full(). Change the wording in the docs. Clarify expectations for (deprecated) g_thread_create().
2011-10-13GThread: make refcounting publicRyan Lortie3-1/+15
2011-10-13thread: simplify 'free' processRyan Lortie2-22/+19
GThread is freed using some very slightly confusing logic: if the thread was created 'joinable', then the structure is freed after the join() call succeeds (since we know the thread has exited). If the thread was not created 'joinable' then the free is when the thread quits (since we know 'join' will not be called later). Move to a straight ref-counting system: 1 ref owned by the thread and 1 extra ref if the thread is joinable. Both thread quit and joining will decrease the refcount by 1.
2011-10-13remove 'joinable' parameter to backendsRyan Lortie4-4/+1
Both backends are now oblivious to the concept of joinability, so don't bother passing the parameter.
2011-10-12posix threads: joinable tweaksRyan Lortie1-5/+19
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-12tests: don't #include <sys/resource.h> on win32Ryan Lortie1-1/+4
2011-10-12win32 threads: simplifyRyan Lortie1-48/+9
Merge the GThreadData with the GThreadWin32 struct. Drop the extra TLS variable. Close the handle on _free(), which means that there is no leak if g_system_thread_join() isn't called. Remove all internal concept of joinability.
2011-10-12Only g_system_thread_free() our own threadsRyan Lortie2-8/+15
Keep track of if we created a thread for ourselves or if the GThread* was allocated in response to g_thread_self() on a previously-unknown thread. Only call g_system_thread_free() in the first case.
2011-10-12Finish killing off GSystemThreadRyan Lortie4-33/+11
2011-10-12win32 threads: use our own data, not system_threadRyan Lortie1-7/+17
Stop using the generic system_thread field in GRealThread. Use our own pointer instead.
2011-10-12win32: fix function name clashRyan Lortie1-2/+2
2011-10-12posix threads: use our own system_threadRyan Lortie1-7/+17
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-12thread creation: Simplify error handlingRyan Lortie3-17/+14
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-12Combine g_sytem_thread_{new,create}()Ryan Lortie4-43/+29
2011-10-12g_system_thread_create: drop 'data' argRyan Lortie4-6/+3
Since it's now always the same as the 'thread' arg.
2011-10-12g_system_thread_create: SystemThread -> RealThreadRyan Lortie4-6/+6
Just like g_system_thread_wait().
2011-10-12Move more docs inlineMatthias Clasen3-300/+269
2011-10-12g_system_thread_join: rename to _wait()Ryan Lortie4-4/+4