Discussion:
Testing and concurrency
Eli Naeher
2014-03-14 15:57:50 UTC
Permalink
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
Luís Oliveira
2014-03-14 17:16:13 UTC
Permalink
Post by Eli Naeher
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.
Post by Eli Naeher
- detecting, handling, and reporting conditions that are raised in threads
other than the main test/reporting thread
http://lparallel.org/handling/
Post by Eli Naeher
- 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)
Post by Eli Naeher
- 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/
Kenneth Tilton
2014-03-14 17:26:05 UTC
Permalink
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
Loading...