This is automatic generated document for things in Swow\Channel class
Class Channel
channel transfers information across coroutines
This class is a generic class. Template T
Methods
Method __construct
Create a channel.
Param int $capacity 0 is unbuffered. -1 is unlimited.
Throws \ValueError when the capacity is negative and not -1
Method __debugInfo
Returns array<string, mixed> debug information for var_dump
Method close
Close the channel.
A queued value can still be popped. A waiting coroutine wakes with error code -125.
Throws ChannelException when the channel is already closed
Method getCapacity
Method getLength
Method hasConsumers
Method hasProducers
Method isAvailable
Method isEmpty
Method isFull
Method isReadable
Method isWritable
Method pop
pop data from channel
context switching happens here when channel is empty, context switching may also happen at this even channel is not empty.
Param int $timeout in milliseconds
Returns T $data
Throws ChannelException on timeout (-110) or when the channel is closed (-9758)
Method push
push data into channel
context switching happens here when channel is full, context switching may also happen at this even channel is not full.
Throws ChannelException on timeout (-110) or when the channel is closed (-9758)