Skip to content
Snippets Groups Projects
Commit d7e568e5 authored by rswindell's avatar rswindell
Browse files

Added msgQueueOwner(), returns TRUE if called from the queue's owning thread.

parent 49dc21d1
Branches
Tags
No related merge requests found
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2005 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
......@@ -63,6 +63,14 @@ msg_queue_t* DLLCALL msgQueueInit(msg_queue_t* q, long flags)
return(q);
}
BOOL DLLCALL msgQueueOwner(msg_queue_t* q)
{
if(q==NULL)
return(FALSE);
return q->owner_thread_id == pthread_self();
}
BOOL DLLCALL msgQueueFree(msg_queue_t* q)
{
if(q==NULL)
......@@ -204,7 +212,7 @@ void* DLLCALL msgQueuePeek(msg_queue_t* q, long timeout)
#endif
;
return listNodeData(listFirstNode(list));
return listNodeData(listFirstNode(list));
}
void* DLLCALL msgQueueFind(msg_queue_t* q, const void* data, size_t length)
......
......@@ -8,7 +8,7 @@
* @format.tab-size 4 (Plain Text/Source Code File Header) *
* @format.use-tabs true (see http://www.synchro.net/ptsc_hdr.html) *
* *
* Copyright 2011 Rob Swindell - http://www.synchro.net/copyright.html *
* Copyright Rob Swindell - http://www.synchro.net/copyright.html *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public License *
......@@ -64,6 +64,7 @@ DLLEXPORT BOOL DLLCALL msgQueueFree(msg_queue_t*);
DLLEXPORT long DLLCALL msgQueueAttach(msg_queue_t*);
DLLEXPORT long DLLCALL msgQueueDetach(msg_queue_t*);
DLLEXPORT BOOL DLLCALL msgQueueOwner(msg_queue_t*);
/* Get/Set queue private data */
DLLEXPORT void* DLLCALL msgQueueSetPrivateData(msg_queue_t*, void*);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment