« Return to Thread: JMock not thread safe - how does one do multi-threaded testing?

Re: JMock not thread safe - how does one do multi-threaded testing?

by Nat Pryce :: Rate this Message:

Reply to Author | View in Thread

2009/4/1 James Abley <james.abley@...>:
> 2009/4/1 Nat Pryce <nat.pryce@...>:
>> JMock is thread-safe if only one thread enters the Mockery at a time.
>
> That's an interesting definition of thread-safe - only safe when one
> thread uses it. :-D

To be pedantic, I said it's safe (by default) when called from
multiple threads, as long as something else is doing the
synchronisation to ensure only one thread is active in the Mockery at
a time.  There are APIs (Swing, for example) for which even this is
not the case: you are only allowed to use objects on the same thread
that created them because of hidden dependencies stored in
thread-local storage.  Nasty!

--Nat

--
http://www.natpryce.com

---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


 « Return to Thread: JMock not thread safe - how does one do multi-threaded testing?