this repo has no description
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

OSAtomicEnqueue operation implementation

+9 -1
+9 -1
libmac/libc/OSAtomic.cpp
··· 218 218 // http://i.stack.imgur.com/FSBA3.png 219 219 void OSAtomicEnqueue(OSQueueHead *list, void *_new, size_t offset) 220 220 { 221 - LIBC_STUB(); 221 + long* newNext = reinterpret_cast<long*>(reinterpret_cast<char*>(_new) + offset); 222 + *newNext = 0; 223 + 224 + // If the queue is not empty 225 + if (!__sync_bool_compare_and_swap(list->p, 0, _new)) 226 + { 227 + void* prevTop = __sync_lock_test_and_set(list->p, _new); 228 + *newNext = prevTop; // FIXME: this place may cause races with OSAtomicDequeue 229 + } 222 230 } 223 231 224 232 void* OSAtomicDequeue(OSQueueHead *list, size_t offset)