OSDN Git Service

* configure.ac: Check for sys/ipc.h and sys/sem.h.
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / testsuite / testsuite_hooks.h
index 4b526e9..79495fb 100644 (file)
@@ -380,6 +380,30 @@ namespace __gnu_test
        return it == end ? v.end() : it;
       }
     };
+
+  // A binary semaphore for use across multiple processes.
+  class semaphore 
+  {
+  public:
+    // Creates a binary semaphore.  The semaphore is initially in the
+    // unsignaled state. 
+    semaphore ();
+
+    // Destroy the semaphore.
+    ~semaphore();
+
+    // Signal the semaphore.  If there are processes blocked in
+    // "wait", exactly one will be permitted to proceed.
+    void signal ();
+
+    // Wait until the semaphore is signaled.
+    void wait ();
+
+  private:
+    int sem_set_;
+
+    pid_t pid_;
+  };
 } // namespace __gnu_test
 
 namespace std