Commit e00e7412 authored by Paweł Wegner's avatar Paweł Wegner
Browse files

Utility: removed semaphore.

parent 9e05f70b
......@@ -24,9 +24,7 @@
#ifndef UTILITY_H
#define UTILITY_H
#include <condition_variable>
#include <memory>
#include <mutex>
#include <string>
#include "IHttpServer.h"
......@@ -65,28 +63,6 @@ IHttpServer::IResponse::Pointer response_from_string(
} // namespace util
class Semaphore {
public:
Semaphore() : count_() {}
void notify() {
std::unique_lock<std::mutex> lock(mutex_);
count_++;
condition_.notify_one();
}
void wait() {
std::unique_lock<std::mutex> lock(mutex_);
while (count_ == 0) condition_.wait(lock);
count_--;
}
private:
std::mutex mutex_;
std::condition_variable condition_;
uint32_t count_;
};
} // namespace cloudstorage
#endif // UTILITY_H
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment