Skip to content

Commit

Permalink
add comment
Browse files Browse the repository at this point in the history
  • Loading branch information
NianJi committed Apr 25, 2019
1 parent 9aec39b commit 7100012
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion coobjc/co/COChan.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,22 @@ typedef void (^COChanOnCancelBlock)(COChan *chan);
/**
Send a value to the Channel.
@see send:onCancel:
@discussion This method may blocking the current process, when there's no one receives and buffer is full.
So, this method requires calling in a coroutine.
@param val the value send to Channel.
*/
- (void)send:(Value _Nullable )val;

/**
Send a value to the Channel.
Requires calling in a coroutine.
@param val the value send to Channel.
@param cancelBlock call back when the coroutine cancels.
*/
- (void)send:(Value _Nullable )val onCancel:(COChanOnCancelBlock _Nullable)cancelBlock;

/**
Expand All @@ -79,7 +88,15 @@ typedef void (^COChanOnCancelBlock)(COChan *chan);
*/
- (Value _Nullable )receive;

- (Value _Nullable )receiveWithOnCancel:(COChanOnCancelBlock _Nullable)cancelBlock;;
/**
Receive a value from the Channel, blocking.
@see `receive`
@return the value received from the channel
@param cancelBlock call back when the coroutine cancels.
*/
- (Value _Nullable )receiveWithOnCancel:(COChanOnCancelBlock _Nullable)cancelBlock;

/**
Send a value to the Channel, non blocking.
Expand Down

0 comments on commit 7100012

Please sign in to comment.