MCPcopy Create free account
hub / github.com/catboost/catboost / Add

Method Add

util/thread/pool.cpp:105–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

103 }
104
105 inline bool Add(IObjectInQueue* obj) {
106 if (ShouldTerminate.load()) {
107 return false;
108 }
109
110 if (Tharr.empty()) {
111 TTsr tsr(Parent_);
112 obj->Process(tsr);
113
114 return true;
115 }
116
117 with_lock (QueueMutex) {
118 while (MaxQueueSize > 0 && Queue.Size() >= MaxQueueSize && !ShouldTerminate.load()) {
119 if (!Blocking) {
120 return false;
121 }
122 QueuePopCond.Wait(QueueMutex);
123 }
124
125 if (ShouldTerminate.load()) {
126 return false;
127 }
128
129 Queue.Push(obj);
130 }
131
132 QueuePushCond.Signal();
133
134 return true;
135 }
136
137 inline size_t Size() const noexcept {
138 auto guard = Guard(QueueMutex);

Callers

nothing calls this directly

Calls 4

loadMethod · 0.45
emptyMethod · 0.45
ProcessMethod · 0.45
SignalMethod · 0.45

Tested by

no test coverage detected