mirror of
https://github.com/vlang/v.git
synced 2025-09-16 07:52:32 +03:00
sync/channels: expose ch.closed
as bool
pseudo attribute (#8244)
This commit is contained in:
parent
820e684313
commit
925ffd76f4
5 changed files with 50 additions and 43 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue