mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
sync/channels: expose ch.closed
as bool
pseudo attribute (#8244)
This commit is contained in:
@ -162,6 +162,11 @@ pub fn (mut ch Channel) len() int {
|
||||
return int(C.atomic_load_u32(&ch.read_avail))
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn (mut ch Channel) closed() bool {
|
||||
return C.atomic_load_u16(&ch.closed) != 0
|
||||
}
|
||||
|
||||
[inline]
|
||||
pub fn (mut ch Channel) push(src voidptr) {
|
||||
if ch.try_push_priv(src, false) == .closed {
|
||||
|
Reference in New Issue
Block a user