summaryrefslogtreecommitdiff
path: root/tests/thread-test.c
Commit message (Collapse)AuthorAgeFilesLines
* Make the tests silent on success.Matthias Clasen2005-07-141-6/+0
| | | | | | | | | | | | | 2005-07-14 Matthias Clasen <mclasen@redhat.com> * tests/spawn-test.c: * tests/uri-test.c: * tests/thread-test.c: * tests/queue-test.c: * tests/mainloop-test.c: * tests/iochannel-test.c: * tests/gio-test.c: * tests/child-test.c: Make the tests silent on success.
* Use GUINT_TO_POINTER for g_thread_create data.Manish Singh2003-11-181-1/+1
| | | | | | | Mon Nov 17 17:28:10 2003 Manish Singh <yosh@gimp.org> * tests/thread-test.c (test_g_thread_once): Use GUINT_TO_POINTER for g_thread_create data.
* Support for one-time initialization functions. (#69668, SebastianMatthias Clasen2003-07-081-0/+79
| | | | | | | | | | | | | 2003-07-09 Matthias Clasen <maclas@gmx.de> Support for one-time initialization functions. (#69668, Sebastian Wilhelmi) * configure.in: Check whether double checked locking is safe, define g_once() in glibconfig.h accordingly. * glib/gthread.h: Add GOnce, GOnceStatus, G_ONCE_INIT and g_once_impl. * glib/gthread.c (g_once_impl): Fallback implementation using a mutex if double checked locking is unsafe. * tests/thread-test.c: Add tests for g_once().
* Added #undef G_DISABLE_ASSERT and #undef G_LOG_DOMAIN throughout theSebastian Wilhelmi2002-07-041-0/+3
| | | | | | | 2002-07-04 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * tests/*.c: Added #undef G_DISABLE_ASSERT and #undef G_LOG_DOMAIN throughout the files, which didn't already have them. (#87312)
* Do not assume, that after g_usleep(G_USEC_PER_SEC) the newly startedSebastian Wilhelmi2002-02-151-7/+25
| | | | | | | | | | | 2002-02-15 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * tests/thread-test.c: Do not assume, that after g_usleep(G_USEC_PER_SEC) the newly started thread began running. Spotted by Miroslaw Dobrzanski-Neumann <mne@mosaic-ag.com>. Make the test_g_static_rw_lock_thread threads wait a random time. Make the test_g_static_rw_lock test run 5 seconds, not 1.
* Renamed g_thread_create to g_thread_create_full and added macroSebastian Wilhelmi2001-05-181-10/+5
| | | | | | | | | | | | | | | | | 2001-05-18 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * gthread.c, gthread.h: Renamed g_thread_create to g_thread_create_full and added macro g_thread_create, which omits 'stack_size', 'bound' and 'priority' parameters. Also removed 'bound' from GThread struct. * gthreadpool.h, gthreadpool.c: Adapted GThreadPool to the above changes. GThreadPool lost the 'priority' and 'bound' members. g_thread_pool_new the 'stack_size', 'bound' and 'priority' parameters. * tests/mainloop-test.c, tests/thread-test.c, tests/threadpool-test.c: Adapted to the above changes.
* Moved func and arg members from GRealThread to GThread, such that they canSebastian Wilhelmi2001-05-081-9/+19
| | | | | | | | | | | | | | | | 2001-05-08 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * gmain.c, gthread.c, gthread.h: Moved func and arg members from GRealThread to GThread, such that they can be accessed by the user. * gthread.c, gthread.h: Due to popular demand (Tim being the populus here ;-) threads now have a 'return value', which is returned by g_thread_join and is either the return of the topmost thread function or the value given to g_thread_exit. * gthreadpool.c, tests/mainloop-test.c, tests/thread-test.c: Adapted to the above change.
* Added functions g_static_rec_mutex_init, g_static_rec_mutex_free,Sebastian Wilhelmi2001-02-131-9/+56
| | | | | | | | | | | | | | | | | | 2001-02-13 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * gthread.c, gthread.h: Added functions g_static_rec_mutex_init, g_static_rec_mutex_free, g_static_private_init, g_static_private_free, g_static_rw_lock_init to allow the usage of all those types dynamically. (g_static_rw_lock_free already existed). Aditionally freed static_private indeces are reused now. Untill now the array would just grow if you would use more and more static_private. That required adding a slist of all running threads, which could potentially be of good use later. It is not exported however. Renamed a LOCK and small indentation fixes. * tests/thread-test.c: Test the new static_private index freing and reusing feature.
* s/G_MICROSEC/G_USEC_PER_SEC/Sebastian Wilhelmi2000-09-061-6/+6
| | | | | | | | | | 2000-09-06 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * glib.h, gtimer.c, tests/thread-test.c: s/G_MICROSEC/G_USEC_PER_SEC/ * gthread/gthread-posix.c, gthread/gthread-solaris.c: s/G_MICROSEC/G_USEC_PER_SEC/ and s/G_NANOSEC/G_NSEC_PER_SEC/
* Include gerror.h before it is used for some g_thread_* functions.Sebastian Wilhelmi2000-09-011-4/+4
| | | | | | | | | | | | | | | | | 2000-09-01 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * glib.h: Include gerror.h before it is used for some g_thread_* functions. * gthread.c, gthreadpool.c, glib.h: Enable error reporting for thread creation, namly for g_thread_create, g_thread_pool_new, g_thread_pool_push and g_thread_pool_set_max_threads. * tests/thread-test.c, tests/threadpool-test.c: Adapted accordingly. * gthread-posix.c (g_thread_create_posix_impl): Use GError to report errors.
* Made the debugging G_TRYLOCK call also work for compilers with funntSebastian Wilhelmi2000-04-191-0/+4
| | | | | | | | | 2000-04-19 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * glib.h (G_TRYLOCK): Made the debugging G_TRYLOCK call also work for compilers with funnt G_STMT_(START|END) macros. * tests/thread-test.c: Implemented a check for that.
* Added the missing POSIX_NO_YIELD and POSIX_NO_PRIORITIES warning messages.Sebastian Wilhelmi2000-03-171-4/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 2000-03-17 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * configure.in: Added the missing POSIX_NO_YIELD and POSIX_NO_PRIORITIES warning messages. * configure.in: Use AC_TRY_RUN instead of AC_TRY_LINK, to test for real thread support. On solaris pthread_create can be linked to even in -lc, but it doesn't work then. * configure.in: Don't use priorities for threads, when the minimal/maximal priorities couldn't be determined at configure time. * configure.in, gthread.c: Always define GSystemThread in glibconfig.h to represent a system thread. * configure.in: Do not use native recursive threads, when possibe. We use some features, that they do not expose (namely the depth counter). * glib.h, gthread.c: Redefined GStaticRecMutex. The functions are now implemented in a different way, which should be way faster. Alsothere are now functions g_static_rec_mutex_unlock_full and g_static_rec_mutex_lock_full to leave/enter a recursive mutex completly. * gthread.c (g_thread_self): Do not test the system_thread to be non-zero to speed things up. * gthread.c (g_mutex_init): Therefore set the system_thread of the main thread here. * tests/thread-test.c: Rerun all tests once again, but this time we fool the system into thinking, that the available thread system is not native, but userprovided. * gthread/gthread-posix.c: Don't use priorities for threads, when the minimal/maximal priorities couldn't be determined at configure time. * gthread/gthread-posix.c: Don't check for errors, when setting the scope of a tread to system, as some posix implementations can't do that and we don't want the thing to fail because of that.
* Completed the thread support in GLib. Thread creation, prioritizingSebastian Wilhelmi1999-06-171-0/+238
1999-06-17 Sebastian Wilhelmi <wilhelmi@ira.uka.de> * configure.in, acglib.m4, acconfig.h, glib.h, gthread.c: Completed the thread support in GLib. Thread creation, prioritizing threads, yielding, joining threads as well as reader/writer locks and recursive mutexes are now in place. Please test heavily on your platform. It is so far tested on Linux/i386/pthreads, Solaris/Sparc/pthreads and Solaris/Sparc/solaristhreads. * gtimer.c, glib.h: Implement g_usleep (gulong microseconds) for thread safe sleeping. (sleep() is not MT-safe at all!) * gutils.c: Avoid compiler warning. * tests/Makefile.am, tests/thread-test.c: New program to test some aspects of the thread implementation. * gthread.c, Makefile.am: Renamed from gmutex.c to reflect the change of content. * configure.in: Purged all appearances of nspr. * gthread/gthread-posix.c, gthread-solaris.c: Added the native implementations for the GLib's extended thread support. * gthread/gthread-nspr.c: Removed for good. NSPR is nothing we would want to build upon. * gthread/gthread.c: Renamed to gthread-impl.c to avoid confusion with ../gthread.c (Formerly known as the file called gmutex.c) * gthread/testgthread.c: Removed. The new and much extended tests are in ../tests/thread-test.c. * gthread/Makefile.am: Changed to reflect the changes above.