guard/listen — pull request #13 by Maher4Ever (2012-03-14 23:43:32+00:00)
Title: Change the way for waiting on events

Hello,

As you all might know, the specs for `Listen` use a lot of sleep calls to ensure events are completed. This results in a delay in the specs. Today I tried another approach to wait for events by using a mix of `mutex`'s ability to block threads and `join`ing on a thread to wait for it.

Locking `mutex`es to block has the same effect that a `sleep` call (in a loop) has with one exception, it's more precise (`sleep` could stay in the loop for one extra round for example).

I know this approach might get complicated a long the way (as it always does with threads and synchronization), but it might speed up the specs and the Gem itself. With the new changes the specs run around 1-2 seconds faster, without changing a line of code in the specs.

I'm curious what you guys think of these changes. Do you think I should continue and try to get rid of `sleep` calls in the specs?