MCPcopy Index your code
hub / github.com/Cyinx/einx / Get

Method Get

queue/rw_queue.go:48–78  ·  view source on GitHub ↗
(event_list []interface{}, count uint32)

Source from the content-addressed store, hash-verified

46}
47
48func (this *RWQueue) Get(event_list []interface{}, count uint32) (uint32, int) {
49 this.read_lock.Lock()
50
51 if this.read_queue.empty() == true {
52 this.write_lock.Lock()
53 if this.exchange() == false {
54 this.write_lock.Unlock()
55 this.read_lock.Unlock()
56 return 0, 0
57 }
58 this.write_lock.Unlock()
59 }
60
61 read_queue := this.read_queue
62 var read_count uint32 = 0
63 var left_count int = 0
64 for {
65 val, ret := read_queue.pop()
66 if ret == false {
67 break
68 }
69 event_list[read_count] = val
70 read_count++
71 if read_count == count {
72 break
73 }
74 }
75 left_count = read_queue.count()
76 this.read_lock.Unlock()
77 return read_count, left_count
78}
79
80func (this *RWQueue) GetOne() interface{} {
81 this.read_lock.Lock()

Callers

nothing calls this directly

Calls 6

exchangeMethod · 0.95
LockMethod · 0.80
emptyMethod · 0.80
UnlockMethod · 0.80
popMethod · 0.80
countMethod · 0.45

Tested by

no test coverage detected