Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
GSoC
GSoC2017
dbtdsilva
libcloudstorage
Commits
e00e7412
Commit
e00e7412
authored
Aug 23, 2017
by
Paweł Wegner
Browse files
Utility: removed semaphore.
parent
9e05f70b
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/Utility/Utility.h
View file @
e00e7412
...
...
@@ -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
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment