Why is a lock released in the next tick?
bileslav opened this issue · comments
Hi there,
I needed to adapt some of the stuff from this package to work with ReactPHP and it works fine,
but I'm not sure I understand the purpose of this line:
Line 48 in f41cf7f
Why is it done this way?
EventLoop::queue
isn't really "next tick", but rather once the event loop regains control, even in the same tick. This is done, because release
is likely called from destructors, which aren't allowed to switch fibers, but it might be better to move EventLoop::queue
to the destructor and not do an async release if release
is called manually.
@kelunik Oh, now I understand.
destructors, which aren't allowed to switch fibers
I didn't know that, very useful information!
Thanks!
Let's change this in the next beta to release only async in the destructor.
This has been fixed in the above commit. 🎉