clj-commons / manifold

A compatibility layer for event-driven abstractions
1.02k stars 106 forks source link

Do not deadlock on exception during first execution in mock-clock #139

Closed dm3 closed 6 years ago

dm3 commented 7 years ago

I only thought of a way to make this work by changing the contract of IClock#every - now it is supposed to wrap the passed-in function into a self-cancelling runnable.

Before this change the attached test-mock-clock-deschedules-after-exception deadlocks on the first every execution. The exception handling code waits for the return value of every which never happens as it's running on the same thread.

ztellman commented 6 years ago

Sorry for not seeing this sooner. This seems like a reasonable change.