v / vlib / sync
Raw file | 27 loc (20 sloc) | 426 bytes | Latest commit hash ef5be22f8
1module sync
2
3pub struct Channel {
4 arr array
5}
6
7pub fn new_channel[T](n u32) &Channel {
8 return &Channel{arr, new_array()}
9}
10
11pub fn (mut ch Channel) close() {}
12
13pub fn (mut ch Channel) push(src voidptr) {
14 #array_push(ch.val.arr,src)
15}
16
17pub fn (ch Channel) len() int {
18 return ch.arr.len
19}
20
21pub fn (ch Channel) closed() bool {
22 return false
23}
24
25pub fn (mut ch Channel) pop(dest voidptr) {
26 #dest.val = array_pop(ch.val.arr)
27}