Commit Graph

10 Commits

Author SHA1 Message Date
Martyn James Russell
f0ee594a80 Updated the documentation to explain that when the maximum threads is > 1
* glib/gthreadpool.c: Updated the documentation to explain that
when the maximum threads is > 1 the sort functionality is not 100%
accurate due to the ramdom nature of the scheduler choosing which
threads to execute. Fixes bug #334943.

* tests/threadpool-test.c: Disabled the debugging by default and
fixed the sort test to set the maximum threads to 1 to guarantee
the thread entry function is called in order.
2006-03-24 15:21:28 +00:00
Sebastian Wilhelmi
f4484f51bf To avoid deadlocks get rid of the settings G_LOCK. Use the
2006-01-17  Sebastian Wilhelmi  <seppi@seppi.de>

	* glib/gthreadpool.c: To avoid deadlocks get rid of the settings
	G_LOCK. Use the unused_thread_queue lock instead. Change
	g_thread_pool_thread_proxy such that threads only wait on
	non-exlusive pools for at most a 1/2 second. Do not reorder tasks
	due to superfluous tasks. Global tasks wait at most for
	max-idle-time milliseconds. Make sure, that no task is woken up
	twice for the same event via a wakeup_serial. This fixes #324228.

	* tests/threadpool-test.c: Adapt test accordingly. Do not pass
	invalid NULL into the thread pools. This as well fixes #327290.
2006-01-17 20:06:27 +00:00
Martyn James Russell
941faa1ca9 - Added new API g_thread_pool_get_idle_time() and
* docs/reference/glib/glib-sections.txt:
* glib/glib.symbols:
* glib/gthreadpool.[ch]:
- Added new API g_thread_pool_get_idle_time() and
g_thread_pool_set_idle_time(). (#324228).

* tests/threadpool-test.c:
- Updated test case to do thread pool sorting, thread pool with
no sorting and a thread pool with idle thread timeouts.
2006-01-03 15:09:52 +00:00
Matthias Clasen
700a71f010 New function to sort tasks pushed into a threadpool. (#324479, Martyn
2005-12-20  Matthias Clasen  <mclasen@redhat.com>

	* glib/glib.symbols:
	* glib/gthreadpool.h:
	* glib/gthreadpool.c (g_thread_pool_set_sort_function): New function
	to sort tasks pushed into a threadpool.  (#324479, Martyn Russell)

	* tests/threadpool-test.c: Test this.
2005-12-21 04:45:56 +00:00
Matthias Clasen
8ac11176ab Don't get stuck in here if immediate is TRUE. (#310954, Hong Jen Yee)
2005-07-20  Matthias Clasen  <mclasen@redhat.com>

	* glib/gthreadpool.c (g_thread_pool_free): Don't get
	stuck in here if immediate is TRUE.  (#310954,
	Hong Jen Yee)

	* tests/threadpool-test.c (main): Test immediate == TRUE.
2005-07-20 17:06:02 +00:00
Sebastian Wilhelmi
d81ac5339f Added #undef G_DISABLE_ASSERT and #undef G_LOG_DOMAIN throughout the
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)
2002-07-04 15:19:30 +00:00
Sebastian Wilhelmi
227d18bc46 Renamed g_thread_create to g_thread_create_full and added macro
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.
2001-05-18 08:44:57 +00:00
Sebastian Wilhelmi
e885fe2462 Moved determination of G_THREAD_FLAGS before G_THREAD_LIBS. Check for
2000-09-28  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

	* configure.in: Moved determination of G_THREAD_FLAGS before
	G_THREAD_LIBS. Check for UnixWare systems and set the right cflags
	and libs there (it needs -Kthread for the native compiler and
	-pthread for gcc). Thanks to Boyd Lynn Gerber <gerberb@zenez.com>
	for the info.

	* configure.in: Fail immediately, when no thread library is found,
	instead of continuing searching for rt libs etc. Changed almost
	all occurances of $enable_threads to $have_threads, as that's,
	what we want.

	* tests/threadpool-test.c: Define vars inside the guard to avoid
	warnings.
2000-09-28 07:54:40 +00:00
Sebastian Wilhelmi
64bbfbb6da Include gerror.h before it is used for some g_thread_* functions.
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.
2000-09-01 13:03:23 +00:00
Sebastian Wilhelmi
1418fe3a6d New File implementing an asynchronous queue to be used for asynchronous
2000-04-28  Sebastian Wilhelmi  <wilhelmi@ira.uka.de>

	* gasyncqueue.c: New File implementing an asynchronous queue to be
	used for asynchronous inter-thread communication.

	* gthreadpool.c: New File implementing a thread pool to be used
	for distributing work among several threads.

	* glib.h: Added the type and function declarations for these two
	types.

	* tests/threadpool-test.c: New File implementing a test for the
	thread pool. This also checks the asynchronous queue underlying
	the thread pool.

	* tests/Makefile.am: Changed accordingly.
2000-04-28 12:24:53 +00:00