SListEntry* SListImpl::flush() { ScopedLock lock(getDetail(this)->lock); SListEntry* result = getDetail(this)->head; getDetail(this)->head = NULL; return result; }
SListEntry* SListImpl::pop() { ScopedLock lock(getDetail(this)->lock); SListEntry* result = getDetail(this)->head; if( result != NULL ) getDetail(this)->head = result->mNext; return result; }
SListImpl::SListImpl() { getDetail(this)->head = NULL; #if defined(USE_MUTEX) pthread_mutex_init(&getDetail(this)->lock, NULL); #else getDetail(this)->lock = 0; // 0 == unlocked #endif }
SListImpl::~SListImpl() { #if defined(USE_MUTEX) pthread_mutex_destroy(&getDetail(this)->lock); #endif }
void SListImpl::push(SListEntry* entry) { ScopedLock lock(getDetail(this)->lock); entry->mNext = getDetail(this)->head; getDetail(this)->head = entry; }
Reduce::~Reduce() { delete getDetail(); }
SListEntry* SListImpl::flush() { return reinterpret_cast<SListEntry*>(InterlockedFlushSList(getDetail(this))); }
SListEntry* SListImpl::pop() { return reinterpret_cast<SListEntry*>(InterlockedPopEntrySList(getDetail(this))); }
void SListImpl::push(SListEntry* entry) { InterlockedPushEntrySList(getDetail(this), reinterpret_cast<SLIST_ENTRY*>(entry)); }
SListImpl::SListImpl() { InitializeSListHead(getDetail(this)); }