Commit graph

2343 commits

Author SHA1 Message Date
dfd70c6069 replace GThreads by the Lumiera thread wrapper 2010-02-11 03:06:42 +01:00
5386fe6fbc clarify (and treat) the race; considered to be test-only
After removing the explicit locking, there is a small
race in case of a "floundering" (simulated) subsystem:
the starting context may go away before the child thread
actually teminates. I consider this a shortcoming of
this test fixture, which isn't intended to be an example
of a real world subsystem, but rather focusses on
error detection within the subsystem runner.
2010-02-07 17:31:28 +01:00
8ad3bf1736 Change subsystem-runner test to remove explicit locking entirely 2010-02-07 02:56:30 +01:00
c406d16fbc threadwrapper-test should have been better written this way... 2010-02-04 18:48:47 +01:00
Christian Thaeter
7ef1bab914 premature fix for the threadwrapper test
Added some more fuzz and sleeping to the test calculation to have a actual
chance to fail when something is not well locked.

Using a premature classlock, locking instances was insufficient.
2010-02-03 10:45:58 +01:00
Christian Thaeter
01839d4e48 update for nobug-201002.1 2010-02-03 10:38:12 +01:00
Christian Thaeter
014c83ff5a PTHREAD_ONCE_INIT can be a macro, fast init trick doesn't work then 2010-01-30 08:40:38 +01:00
Christian Thaeter
2b74d82f13 remove threadpool initialization, this is done elsewhere now
Subsystem runner/-test is still broken, sometimes segfaults
2010-01-30 07:37:32 +01:00
Christian Thaeter
32d9a9f9ad FIX: thread-wrapper proxy the catched error up to the joiner 2010-01-30 07:20:09 +01:00
Christian Thaeter
e4e87e8cdd log error while setting it 2010-01-30 07:20:09 +01:00
Christian Thaeter
87465ff69b little test-helper cosmetics 2010-01-30 07:20:09 +01:00
Christian Thaeter
dc5ae73626 Log the error passing when joining threads 2010-01-30 07:20:09 +01:00
Michael Ploujnikov
6aacf490a3 add a comile-only test with threads sleeping for random intervals 2010-01-29 22:42:28 -05:00
Michael Ploujnikov
362069ea53 make the process-function test run really quickly 2010-01-29 22:42:28 -05:00
Michael Ploujnikov
f69006aa54 test spawning a bunch of short sleeping threads 2010-01-29 22:42:20 -05:00
Michael Ploujnikov
b87db7eb8f re-add a test message that I forgot 2010-01-29 22:01:48 -05:00
Michael Ploujnikov
9d7f6a1fce don't test the kind anymore (too simple)
Conflicts:

	tests/30backend-threadpool.tests
2010-01-29 21:52:12 -05:00
Michael Ploujnikov
3611fbcf7c also ignore RESOURCE_ENTER, RESOURCE_STATE and RESOURCE_LEAVE in the test output 2010-01-29 21:49:11 -05:00
Christian Thaeter
74560cdd99 remove some lock sections in thread two_acquire_test
After acquired, the caller 'owns' the thread handle and can inspect it,
the associated thread is defined to be waiting for a wakeup signal
(and then one shouldn't do unlocked access to the thread handle)
2010-01-30 03:30:08 +01:00
Christian Thaeter
4aa5380311 FIX: two-threads-acquire test, eternal wait for wakeup signal 2010-01-30 02:57:57 +01:00
Christian Thaeter
812f7112af FIX: small race in acquire_thread, catching threads out of the void 2010-01-30 02:56:50 +01:00
Christian Thaeter
f57d637b59 Merge commit 'dc87e78590ea86615d3ebe90d23af4548445b941' into backend_devel
* commit 'dc87e78590ea86615d3ebe90d23af4548445b941':
  add a two-thread acquire test
  show the state of the thread in question
  minor fixes: remove an old comment and change another
  fix the prime test algorithm
  use unsigned long for even more digits!
2010-01-30 00:48:04 +01:00
Michael Ploujnikov
dc87e78590 add a two-thread acquire test
currently this results in a deadlock between lumiera_threadpool_destroy() and thread_loop()
2010-01-26 17:02:31 -05:00
Christian Thaeter
6659ab6ac1 Merge remote branch 'ichthyo/thread_integration' into backend_devel
* ichthyo/thread_integration:
  automatically start the threadpool on demand, similar to NoBug
  refactor the C++ thread-wrapper, remove JoinHandle
2010-01-24 16:24:38 +01:00
ede06e63d5 automatically start the threadpool on demand, similar to NoBug
but the difference is: threadpool comes up application init i.e. at the begin of main(),
while NoBug comes up in static init already.
2010-01-24 15:48:48 +01:00
93af4ed017 refactor the C++ thread-wrapper, remove JoinHandle 2010-01-24 14:05:32 +01:00
Christian Thaeter
f17249713c WIP: subsystem runner test, still broken
using new thread synchronization

Disabled further tests, making one after another working.

Some notes:
 * currently running this leads to different outcomes on differnt runs,
   there are some races/unsyncronized things left, to be investigated.
 * I suggest to make Subsystems joinable, this prolly needs some work in
   the error handling department (thread-wrapper.hpp too)
 * using nonrecursive/waitable lock, recursive locks are have some bad
   taste unless absolutely necessary
 * after all a timed lock with polling is not the right approach to check
   for subsystem shutdowns, I opted against thread cancelation because of
   its programming overhead and complexity. We may refine this and allow
   synchronous cancellation (with an approbiate thread flag) in some cases.
2010-01-23 06:57:15 +01:00
Christian Thaeter
8607a4006a update the thread-wrapper to use the new threading API
This removes the explicit Sync things from the thread wraper since
the functionality is almost exactly provided by the backend.

Thread encapsulates a lumiera thread handle now, but this is strictly
optional and might be dropped on the floor (using a temporary as thread).

Thread has a sync() function which allows user controlled syncronous
startup:

 Thread("foo", myoperation).sync();

will startup myoperation and only return from the ctor after myoperation
called a matching lumiera_thread_sync().

The related tests need to initialize/destroy the threadpool accordingly
2010-01-23 06:57:14 +01:00
Christian Thaeter
9fc68c9d32 Merge remote branch 'public/nobug201001.2' into backend_devel
* public/nobug201001.2:
  integrating nobug context passing
  updates for nobug 201001.2

Conflicts:
	configure.ac
	src/lib/condition.h
	src/lib/reccondition.h
	tests/backend/test-threads.c
2010-01-23 06:56:39 +01:00
Christian Thaeter
c15f2247d7 integrating nobug context passing
Somewhat more intrusive than the previous patch,
adds contexts everywhere except for sync.hpp where only default ctors
are used.
2010-01-23 01:40:27 +01:00
Christian Thaeter
8254b3fbda updates for nobug 201001.2
dumping got a new api, surprisingly everything else works...
2010-01-22 23:21:48 +01:00
Michael Ploujnikov
fc15a2ac2c Merge commit '6f07e4eedc6b624b1f9ae1004ad3e6a77027e028' into second-tp-attempt
Conflicts:
	src/backend/threads.c
2010-01-20 21:41:14 -05:00
Michael Ploujnikov
a22bb5e54f show the state of the thread in question 2010-01-20 17:09:37 -05:00
Michael Ploujnikov
571c265ccd minor fixes: remove an old comment and change another 2010-01-20 07:58:22 -05:00
Michael Ploujnikov
fca6cd786b fix the prime test algorithm
actually test for the output of the function
2010-01-20 07:54:26 -05:00
Christian Thaeter
751a8b415c few trace points 2010-01-20 01:04:35 +01:00
Christian Thaeter
6f07e4eedc one more signal/wait for syncing 2010-01-20 01:04:12 +01:00
Christian Thaeter
95fed7fd0e remove thread counters (for now)
counting the threads had a race when creating threads, with moving
threads only between idle and working list we don't need the counters for
operation anyways. Maybe later when we find out that we need them we can
re-add them in a sane way
2010-01-20 01:03:41 +01:00
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
cd39533899 the thread-wrapper tests need to init/destroy the threadpool 2010-01-19 18:46:32 +01:00
Christian Thaeter
995d813709 add threadpool init/destroy to the global backend init/destroy 2010-01-19 18:46:02 +01:00
Christian Thaeter
5bc993077a Merge remote branch 'plouj/second-tp-attempt' into backend_devel
* plouj/second-tp-attempt:
  use the largest prime that can fit in an it
  don't expect a message about waiting anymore
  scons: propagate PKG_CONFIG_PATH when checking for library
  python-2.6 fix: loading the icon_rener.py script (Ticket #222)
  Use a fully qualified name for PlacementMO in PlacementIndex
2010-01-19 13:58:26 +01:00
Michael Ploujnikov
613da389c4 Merge remote branch 'ct/backend_devel' into second-tp-attempt 2010-01-18 21:15:30 -05:00
Christian Thaeter
8226e63bf7 FIX:add extra dependencie on precreated icons, fixes #111
this could prolly made simpler, but fixes the issue for now
2010-01-19 00:27:49 +01:00
Christian Thaeter
66a0e6e0ca Experiment: remove custom states, syncs are 2-thread barriers 2010-01-18 19:58:31 +01:00
Michael Ploujnikov
bcfedcd4a6 Merge remote branch 'ct/backend_devel' into second-tp-attempt 2010-01-18 12:45:57 -05: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
Michael Ploujnikov
fb61813650 use unsigned long for even more digits! 2010-01-18 12:43:28 -05:00
Michael Ploujnikov
ffdbc7083b use the largest prime that can fit in an it
don't hard-code the number in the test
2010-01-18 12:16:45 -05:00