2004-02-23 20:37:08 +00:00
|
|
|
#include "libnazgul.h"
|
|
|
|
|
2004-02-26 09:23:37 +00:00
|
|
|
int msgQueueDelete(msgQueueId externId,int queueIdx){
|
|
|
|
msgQueue * queue;
|
|
|
|
msgQueueId queueId;
|
2004-02-23 20:37:08 +00:00
|
|
|
|
2004-02-26 09:23:37 +00:00
|
|
|
msgQueueIdIntern(queueId,externId,queueIdx);
|
|
|
|
queue = msgQueueOpen(queueId);
|
2019-09-17 12:49:28 +00:00
|
|
|
|
2004-02-26 09:23:37 +00:00
|
|
|
if (strcmp(queue->headId,queue->id)!=0){
|
|
|
|
// liste non-vide
|
|
|
|
if (msgQueueElemDelete(queue->headId) <0){
|
|
|
|
NZG_ERROR("msgQueueElemDelete",queue->headId);
|
|
|
|
goto ERROR;
|
|
|
|
}
|
2004-02-23 20:37:08 +00:00
|
|
|
}
|
2004-02-26 09:23:37 +00:00
|
|
|
|
|
|
|
msgQueueSemId queueProtLockSemId;
|
|
|
|
msgQueueSemId queueReadLockSemId;
|
|
|
|
msgQueueProtSemIdIntern(queueProtLockSemId,externId,queueIdx);
|
|
|
|
msgQueueReadSemIdIntern(queueReadLockSemId,externId,queueIdx);
|
|
|
|
sem_unlink(queueProtLockSemId);
|
|
|
|
sem_unlink(queueReadLockSemId);
|
2004-02-23 20:37:08 +00:00
|
|
|
|
2004-02-26 09:23:37 +00:00
|
|
|
if (shm_unlink(queueId) < 0){
|
|
|
|
NZG_ERROR("shm_unlink msgQueueElem",queueId);
|
|
|
|
goto ERROR;
|
|
|
|
}
|
2004-02-23 22:34:28 +00:00
|
|
|
|
2004-02-26 09:23:37 +00:00
|
|
|
return 0;
|
2004-02-23 20:37:08 +00:00
|
|
|
ERROR:
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|