mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-24 09:12:28 +02:00
* fix(NamedEvent): Release semaphore ID in dtor when created with semget (#2971) * Temporary: trying to solve for non-Linux semaphores. * chore(NamedEvent): Cleanup of Posix NamedEvent and fixes of unit test.
This commit is contained in:
@@ -17,12 +17,21 @@
|
||||
#ifndef Foundation_NamedEvent_UNIX_INCLUDED
|
||||
#define Foundation_NamedEvent_UNIX_INCLUDED
|
||||
|
||||
|
||||
#include "Poco/Foundation.h"
|
||||
|
||||
#include <Poco/Platform.h>
|
||||
|
||||
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) || defined(_AIX) || defined(__GNU__)
|
||||
#include <semaphore.h>
|
||||
#define POCO_NAMED_EVENT_USE_POSIX_SEMAPHORES 1
|
||||
#define POCO_NAMED_EVENT_USE_SYS_V_SEMAPHORES 0
|
||||
#else
|
||||
#define POCO_NAMED_EVENT_USE_POSIX_SEMAPHORES 0
|
||||
#define POCO_NAMED_EVENT_USE_SYS_V_SEMAPHORES 1
|
||||
#endif
|
||||
|
||||
#if POCO_NAMED_EVENT_USE_POSIX_SEMAPHORES
|
||||
#include <semaphore.h>
|
||||
#endif
|
||||
|
||||
namespace Poco {
|
||||
|
||||
@@ -39,10 +48,11 @@ private:
|
||||
std::string getFileName();
|
||||
|
||||
std::string _name;
|
||||
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) || defined(_AIX) || defined(__GNU__)
|
||||
sem_t* _sem;
|
||||
#if POCO_NAMED_EVENT_USE_POSIX_SEMAPHORES
|
||||
::sem_t* _sem;
|
||||
#else
|
||||
int _semid; // semaphore id
|
||||
bool _createdId; // semaphore id was created with this instance
|
||||
#endif
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user