MCPcopy Create free account
hub / github.com/cameron314/concurrentqueue / enqueue

Method enqueue

tests/relacy/relacy/test/main.cpp:47–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

45 }
46
47 void enqueue(void* data)
48 {
49 node_t* n = new node_t;
50 n->VAR(next) = 0;
51 n->VAR(data) = data;
52 bool was_empty = false;
53
54 pthread_mutex_lock(&mtx);
55 if (VAR(head) == 0)
56 {
57 was_empty = true;
58 VAR(head) = n;
59 VAR(tail) = n;
60 }
61 else
62 {
63 VAR(tail)->VAR(next) = n;
64 VAR(tail) = n;
65 }
66 pthread_mutex_unlock(&mtx);
67
68 if (was_empty)
69 pthread_cond_broadcast(&cv);
70 }
71
72 void* dequeue()
73 {

Callers 15

threadMethod · 0.45
threadMethod · 0.45
threadMethod · 0.45
threadMethod · 0.45
threadMethod · 0.45
threadMethod · 0.45
threadMethod · 0.45
threadMethod · 0.45
threadMethod · 0.45
threadMethod · 0.45
threadMethod · 0.45
threadMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected