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