- if(!(type & WHOQUEUETYPE_ISONQUEUE)) return;
- struct WHOQueueEntry* entry = getNextWHOQueueEntry(client, 1);
- if(entry == NULL || (entry->type & WHOQUEUETYPE_CHECKTYPE) != (type & WHOQUEUETYPE_CHECKTYPE)) return;
- if(type & WHOQUEUETYPE_USERLIST) {
+ struct WHOQueueEntry* entry = getNextWHOQueueEntry(client, type, 0);
+ if(entry == NULL) return;
+ #ifdef HAVE_THREADS
+ unsigned long tid = syscall(SYS_gettid);
+ if(entry->lock_tid != tid) {
+ entry->lock_count++;
+ SYNCHRONIZE(entry->lock_mutex);
+ if(entry->lock_tid == -1) {
+ return; //entry has been destroyed
+ }
+ entry->lock_tid = tid;
+ }
+ #endif
+ getNextWHOQueueEntry(client, type, 1);
+ if(entry->type & WHOQUEUETYPE_USERLIST) {