Testing and concurrency
Hello, Recently I've begun writing tests which need to do things in several threads. I'm curious as to what approaches other people have taken when doing this, and whether any of the CL test frameworks address this situation specifically. Some of the things I've run into: - detecting, handling, and reporting conditions that are raised in threads other than the main test/reporting thread - ensuring that the main test thread waits for the other threads before checking for the correct results (and before returning) - forcing things in different threads to happen at the same time (I've been using SBCL's timers for this) Any thoughts or pointers toward best-practices here would be appreciated. Thank you, -Eli
On Fri, Mar 14, 2014 at 3:57 PM, Eli Naeher <enaeher@gmail.com> wrote:
Recently I've begun writing tests which need to do things in several threads. I'm curious as to what approaches other people have taken when doing this, and whether any of the CL test frameworks address this situation specifically.
I don't have much experience with lparallel yet, but I think it provides the building blocks you're looking for.
- detecting, handling, and reporting conditions that are raised in threads other than the main test/reporting thread
http://lparallel.org/handling/
- ensuring that the main test thread waits for the other threads before checking for the correct results (and before returning)
http://lparallel.org/promises/ (or possibly other constructs depending on your concrete use case)
- forcing things in different threads to happen at the same time (I've been using SBCL's timers for this)
Queues or channels might help here. HTH, -- Luís Oliveira http://kerno.org/~luis/
A special variable binding in place when a thread is created will constitute a shared resource one can use variously and cleverly to coordinate/communicate. hth, hp -- Kenneth Tilton Fort Lauderdale, FL http://tiltontec.com http://socialalgebra.com
participants (3)
-
Eli Naeher
-
Kenneth Tilton
-
Luís Oliveira