Skip to content

Commit

Permalink
Temporary: trying to solve for non-Linux semaphores.
Browse files Browse the repository at this point in the history
  • Loading branch information
matejk committed Mar 26, 2024
1 parent a2b106e commit 95c5609
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions Foundation/src/NamedEvent_UNIX.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ NamedEventImpl::~NamedEventImpl()
{
#if defined(sun) || defined(__APPLE__) || defined(__osf__) || defined(__QNX__) || defined(_AIX) || defined(__GNU__)
sem_close(_sem);
sem_unlink(_name.c_str());
#else
if (_createdId)
{
Expand Down
10 changes: 10 additions & 0 deletions Foundation/testsuite/src/NamedEventTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@
#include "Poco/Timestamp.h"
#include "Poco/Exception.h"

#include <iostream>

using Poco::NamedEvent;
using Poco::Thread;
using Poco::Runnable;
Expand Down Expand Up @@ -103,7 +105,15 @@ void NamedEventTest::testNamedEvent()

void NamedEventTest::testCreateManyNamedEvents()
{

std::string name;
for (int i = 0; i < 40000; i++)
{
name = std::string("TestEvent ") + std::to_string(i);
if (sem_unlink(name.c_str()))
std::cout << "sem_unlink failed: " << errno << std::endl;
}

try
{
int i = 0;
Expand Down

0 comments on commit 95c5609

Please sign in to comment.