aboutsummaryrefslogtreecommitdiff
path: root/devel/cppcommon/files/patch-source_threads_named__semaphore.cpp
blob: e95053d1471e49591a84e12bade01e8eecfb7a8c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
--- source/threads/named_semaphore.cpp.orig	2026-02-27 14:10:30 UTC
+++ source/threads/named_semaphore.cpp
@@ -41,11 +41,11 @@ class NamedSemaphore::Impl (public)
 #if (defined(unix) || defined(__unix) || defined(__unix__) || defined(__APPLE__)) && !defined(__CYGWIN__)
         _owner = true;
         // Try to create a named binary semaphore
-        _semaphore = sem_open(name.c_str(), (O_CREAT | O_EXCL), 0666, resources);
+        _semaphore = sem_open(("/" + name).c_str(), (O_CREAT | O_EXCL), 0666, resources);
         if (_semaphore == SEM_FAILED)
         {
             // Try to open a named binary semaphore
-            _semaphore = sem_open(name.c_str(), O_CREAT, 0666, resources);
+            _semaphore = sem_open(("/" + name).c_str(), O_CREAT, 0666, resources);
             if (_semaphore == SEM_FAILED)
                 throwex SystemException("Failed to initialize a named semaphore!");
             else
@@ -67,7 +67,7 @@ class NamedSemaphore::Impl (public)
         // Unlink the named semaphore (owner only)
         if (_owner)
         {
-            result = sem_unlink(_name.c_str());
+            result = sem_unlink(("/" + _name).c_str());
             if (result != 0)
                 fatality(SystemException("Failed to unlink a named semaphore!"));
         }