Commit graph

49 commits

Author SHA1 Message Date
Christian Thaeter
12968bb784 thread kind and flag handling
* 256 states are enough for anyone (else fix the source)
 * add proper masking and handling of flags
2010-01-20 00:43:11 +01:00
Christian Thaeter
32217debe8 Fix threadloop
* joining must be done inside the loop, doh
 * a thread must release itself first in the loop, new threads
   have to go idle when created
2010-01-20 00:33:08 +01:00
Christian Thaeter
66a0e6e0ca Experiment: remove custom states, syncs are 2-thread barriers 2010-01-18 19:58:31 +01:00
Christian Thaeter
e2c5aceec4 FIX: off by one error in time normalization
"The value of the nanoseconds field must be in the range 0 to 999999999."
2010-01-18 18:45:02 +01:00
Christian Thaeter
7371db8a2c thread deadlines, first implementation 2010-01-18 16:24:45 +01:00
Christian Thaeter
cc4dc25f4a while loop is little more solid than do..while 2010-01-18 16:23:28 +01:00
Christian Thaeter
e55e648f29 Thread syncronization and joining
add a custom defined range for states
provide functions for barrier like syncing between 2 threads
provide joinable threads and a thread_join() function
2010-01-18 00:34:53 +01:00
Michael Ploujnikov
c78571be55 more formatting fixes to put spaces before function/macro call opening brackets 2010-01-16 13:53:42 -05:00
Michael Ploujnikov
02c9ee33c7 fix the code by re-merging some of cehteh's changes
test still fails
2010-01-16 11:48:48 -05:00
Michael Ploujnikov
e60c10a01d remove redundant info from TRACE
and add spaces for formatting
2010-01-16 10:39:45 -05:00
Michael Ploujnikov
e9ae8c8601 add a thread state check and remove an old comment 2010-01-15 07:35:28 -05:00
Michael Ploujnikov
09fd15d5f8 die regardless of what type of failure pthread_create() encounters 2010-01-12 08:01:54 -05:00
Michael Ploujnikov
b49a5abff2 mark thread as worker 2010-01-12 07:47:28 -05:00
Michael Ploujnikov
f890b35a03 continuation of working_list introduction 2010-01-11 15:04:52 -05:00
Michael Ploujnikov
fd4504c9de merge ECHO with TRACE 2010-01-08 16:38:35 -05:00
Michael Ploujnikov
56cf53adb3 fix compilation 2010-01-07 18:36:51 -05:00
Michael Ploujnikov
d989babc8a Merge remote branch 'ct/for_plouj2' into second-tp-attempt
Conflicts:
	src/backend/thread-wrapper.hpp
	src/backend/threadpool.c
	src/backend/threadpool.h
	src/backend/threads.c
2010-01-07 07:18:23 -05:00
Michael Ploujnikov
03fe6dd658 properly initialize and de-initialize the thread condition variable 2009-12-31 07:37:28 -05:00
Michael Ploujnikov
ad404bd41a remove unused old code 2009-12-31 07:30:46 -05:00
Michael Ploujnikov
d63a6066a0 insert a space between the function name and the ( in each function call 2009-12-31 07:27:45 -05:00
Christian Thaeter
88195087d6 recondition to condition,
remove the mutex from the pool
rename park to release :P
2009-12-24 01:54:49 +01:00
Christian Thaeter
6b4415d8fa nobugify
declare and init the nobug flags and use them for logging diagnostics
2009-12-24 01:50:59 +01:00
Christian Thaeter
bddb23d111 remove threadpool_unlink()
thread removes itself from the list, this is trival in place
2009-12-24 01:45:44 +01:00
Michael Ploujnikov
f2406c23a1 bork bork bork
by pulling this you agree to...
2009-12-23 13:10:31 -05:00
Michael Ploujnikov
24e87c815d remove old functions pthread_runner and lumiera_thread_run 2009-12-17 22:08:57 -05:00
Michael Ploujnikov
098d801d00 give each thread pool a separate pthread_attr_t structure to configure 2009-12-02 22:21:49 -05:00
Michael Ploujnikov
eedfafb0d0 convert lumiera_thread_state to using the enum string trick and use it in a test 2009-11-29 18:06:14 -05:00
Michael Ploujnikov
fc16de332f convert lumiera_thread_class to using the enum string trick and use it in a test 2009-11-29 17:55:20 -05:00
Michael Ploujnikov
c31bc2791b remove unnecessary REQUIREs based on my new understanding of nobug 2009-11-26 11:52:19 -05:00
Michael Ploujnikov
af80622ef5 begin implementing a 'soft' thread count limit per pool
add LUMIERA_DIE in cases where this soft limit is reached
add LUMIERA_DIE when pthread_create fails to create threads - serious
add a test which tries to break the soft limit
2009-11-26 10:24:18 -05:00
Michael Ploujnikov
98c608d4c0 check that we're creating valid lumiera_thread_structures
die on pthread_create errors that we shouldn't be handling
2009-11-26 10:24:18 -05:00
Michael Ploujnikov
085216fd61 remove "allocated thread*" messages from lumiera_thread_new() and update tests 2009-11-26 10:24:17 -05:00
Michael Ploujnikov
07962b5314 add comments about locking in lumiera_threadpool_release_thread()
output the size of the created thread struct
don't print "destroying thread" (lets tests become shorter with repeated matching)
add a test which spans many threads in all pools
2009-11-26 10:24:17 -05:00
Michael Ploujnikov
8e3d4e7b7a fixed lumiera_threadpool_destroy() by using LLIST_FOREACH
added some checks to lumiera_threadpool_release_thread(), maybe too much
modified thread_loop() to return a known value - 0
added checks to lumiera_thread_new()
added a check to lumiera_thread_destroy()
made lumiera_thread_destroy() unlink the thread from a pool list
updated test case to match new debug messages
2009-11-26 10:24:17 -05:00
Michael Ploujnikov
d6d81f2e44 added lumiera_threadpool_destroy()
added locking and checks to lumiera_threadpool_acquire_thread()
added a nobug flag to threads.c
added lumiera_thread_destroy()
added lumiera_thread_delete()
2009-11-26 10:24:17 -05:00
Michael Ploujnikov
414b8b99c3 updated test passes
fixed problem with copying lists
2009-11-26 10:24:17 -05:00
Michael Ploujnikov
10f79290a1 add lumiera_threadpool_release_thread
make the test compile
change from type to kind
2009-11-26 10:24:17 -05:00
Michael Ploujnikov
9dd838b129 acquire() test started, so far, everything just compiles 2009-11-26 10:24:17 -05:00
Michael Ploujnikov
00eb4eda46 partial code skeleton 2009-11-26 10:24:17 -05:00
37c0175bd1 fix crash on closing lumiera, in case of starting multiple threads 2009-06-19 00:45:08 +02:00
b6d22bb2e0 fix: condition for signalling thread termination is optional 2009-06-05 05:04:45 +02:00
Christian Thaeter
dd9b7a174f Add reccondition to threads, make its functionality complete
With this the threads are now usable, despite still a mockup
implementation.

Some basic tests to show their use included.
2009-06-03 18:22:11 +02:00
Christian Thaeter
65142d9cae WIP: deploy new logging flags in backend 2009-01-24 22:30:25 +01:00
Christian Thaeter
bb8ad9fbd5 move threads back into the backend 2009-01-16 02:18:58 +01:00
5b68a39cc4 move threads from backend to liblumiera
otherwise lib and common would depend on backend
2009-01-10 21:50:03 +01:00
120fbf8f01 temporary addition: signalling successful thread creation
(I take it the final implementation will provide something equivalent,
without such a check, failure to create the thread results in deadlock)
2009-01-02 08:01:51 +01:00
Christian Thaeter
532f609ea1 experimental thread implementation
* This spawns a thread, almost as proposed
 * The condition variable for finishing is not yet implemented
 * Most Parameters are ignored
2008-12-29 01:50:38 +01:00
e0b698d25a additions to make threads.c compile (empty) 2008-12-26 22:27:47 +01:00
Christian Thaeter
121599dc89 lowest level thread api proposal 2008-12-23 08:44:30 +01:00