Hi Mike,

> On Dec 21, 2020, at 7:38 PM, Mike Schinkel <m...@newclarity.net> wrote:
> 
> Would it be appropriate of me to ask for a section that discusses how that 
> might be done in user space in the RFC, at least with some simple 
> pseudo-code, or if is it non-trivial than a link to where it is discussed in 
> depth? 

Absolutely! I added a short example implementation of a mutex to the RFC under 
https://wiki.php.net/rfc/fibers#how_do_various_fibers_access_the_same_memory. 
The code uses a simple queue of fibers waiting to access the mutex to acquire 
and release the lock.

A channel might be implemented with a queue of messages where the receiving 
fiber suspends if the queue is empty. Sending a message on the channel would 
resume a suspended fiber that was waiting to receive a message.

Hopefully that helps. If something is still unclear or an additional example 
would help, don't hesitate to ask.

Cheers!
Aaron Piotrowski

--
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: https://www.php.net/unsub.php

Reply via email to