MCPcopy Create free account
hub / github.com/ROCm/clr / setCallback

Method setCallback

rocclr/platform/command.cpp:191–212  ·  view source on GitHub ↗

================================================================================================

Source from the content-addressed store, hash-verified

189
190// ================================================================================================
191bool Event::setCallback(int32_t status, Event::CallBackFunction callback, void* data,
192 bool blocking) {
193 assert(status >= CL_COMPLETE && status <= CL_QUEUED && "Invalid status");
194
195 CallBackEntry* entry = new CallBackEntry(status, callback, data, blocking);
196 if (entry == NULL) {
197 return false;
198 }
199
200 entry->next_ = callbacks_;
201 while (!callbacks_.compare_exchange_weak(
202 entry->next_, entry)); // Someone else is also updating the head of the linked list! reload.
203
204 // Check if the event has already reached 'status'
205 if (this->status() <= status && entry->callback_ != CallBackFunction(0)) {
206 if (entry->callback_.exchange(NULL) != NULL) {
207 callback(as_cl(this), status, entry->data_);
208 }
209 }
210
211 return true;
212}
213
214// ================================================================================================
215void Event::processCallbacks(int32_t status) const {

Callers 3

EnqueueCommandsMethod · 0.45
streamCallback_commonFunction · 0.45
RunMethod · 0.45

Calls 2

statusMethod · 0.95
as_clFunction · 0.85

Tested by

no test coverage detected