MCPcopy Create free account
hub / github.com/cuberite/cuberite / EnqueueItemIfNotPresent

Method EnqueueItemIfNotPresent

src/OSSupport/Queue.h:67–81  ·  view source on GitHub ↗

Enqueues an item in the queue if not already present (as determined by operator ==). Blocks other threads from accessing the queue.

Source from the content-addressed store, hash-verified

65
66 /// Enqueues an item in the queue if not already present (as determined by operator ==). Blocks other threads from accessing the queue.
67 void EnqueueItemIfNotPresent(ItemType a_Item)
68 {
69 cCSLock Lock(m_CS);
70
71 for (iterator itr = m_Contents.begin(); itr != m_Contents.end(); ++itr)
72 {
73 if ((*itr) == a_Item)
74 {
75 Funcs::Combine(*itr, a_Item);
76 return;
77 }
78 }
79 m_Contents.push_back(a_Item);
80 m_evtAdded.Set();
81 }
82
83
84 /// Dequeues an item from the queue if any are present.

Callers 1

QueueSaveChunkMethod · 0.80

Calls 3

beginMethod · 0.80
endMethod · 0.80
SetMethod · 0.45

Tested by

no test coverage detected