MCPcopy Create free account
hub / github.com/MegEngine/MegFlow / close

Method close

flow-rs/src/channel/inner.rs:67–80  ·  view source on GitHub ↗

Closes the channel and notifies all blocked operations. Returns `true` if this call has closed the channel and it was not closed already.

(&self)

Source from the content-addressed store, hash-verified

65 ///
66 /// Returns `true` if this call has closed the channel and it was not closed already.
67 pub(super) fn close(&self) -> bool {
68 if self.queue.close() {
69 // Notify all send operations.
70 self.send_ops.notify(usize::MAX);
71
72 // Notify all receive and stream operations.
73 self.recv_ops.notify(usize::MAX);
74 self.stream_ops.notify(usize::MAX);
75
76 true
77 } else {
78 false
79 }
80 }
81}
82
83pub fn bounded<T>(cap: usize) -> Arc<Channel<T>> {

Callers 2

test_closedFunction · 0.45
dropMethod · 0.45

Calls 1

notifyMethod · 0.80

Tested by 1

test_closedFunction · 0.36