MCPcopy Create free account
hub / github.com/danoon2/Boxedwine / allocFutex

Function allocFutex

source/kernel/kthread.cpp:274–294  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

272}
273
274struct futex* allocFutex(KThread* thread, U64 address, U32 millies) {
275 int i=0;
276
277 for (i=0;i<MAX_FUTEXES;i++) {
278 if (system_futex[i].thread== nullptr) {
279 BOXEDWINE_CRITICAL_SECTION_WITH_CONDITION(system_futex[i].cond);
280 if (system_futex[i].thread != nullptr) {
281 continue;
282 }
283 system_futex[i].thread = thread;
284 system_futex[i].address = address;
285 system_futex[i].expireTimeInMillies = millies;
286 system_futex[i].wake = false;
287 system_futex[i].mask = 0;
288 system_futex[i].waiting = false;
289 return &system_futex[i];
290 }
291 }
292 kpanic("ran out of futexes");
293 return nullptr;
294}
295
296void freeFutex(struct futex* f) {
297 f->thread = nullptr;

Callers 1

futexMethod · 0.85

Calls 1

kpanicFunction · 0.85

Tested by

no test coverage detected