Plan 9 from Bell Labs’s /usr/web/sources/patch/applied/closeforchannels/readme

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


Close for channels, similar to go, but
the details differ because this is C.
Added two functions, chanclose and chanisclosed.
We also added an err field to the alt entry, which
does not need to be initialized.

Chanclose prevents further elements to be sent to the
channel c. After closing a channel, send and recv never
block.  Send always returns -1.  Recv returns -1 if the
channel is empty.  Alt may choose a CHANSND or CHANRCV that
 failed because the channel was closed.  In this case, the
 err field of the Alt entry points to an error string stating
that the channel was closed and the operation was completed
with failure.  If all entries have been selected and failed
because they were closed, alt returns -1.


Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.