mirror of
https://github.com/HIllya51/LunaHook.git
synced 2024-11-27 07:44:02 +08:00
c94547bbc9
This reverts commit 975f049797
.
1
1
Revert "Update QtLoader_inline.cpp"
This reverts commit 372dd2dc3e2f23c810f13e51437904fac1422c04.
Update QtLoader_inline.cpp
Update QtLoader_inline.cpp
1
1
1
Update CMakeLists.txt
1
1
29 lines
551 B
C++
29 lines
551 B
C++
template<class T>
|
|
class lockedqueue{
|
|
std::mutex lock;
|
|
std::queue<T>data;
|
|
HANDLE hsema;
|
|
public:
|
|
lockedqueue(){
|
|
hsema=CreateSemaphore(NULL,0,65535,NULL);
|
|
}
|
|
~lockedqueue(){
|
|
CloseHandle(hsema);
|
|
}
|
|
void push(T _){
|
|
std::lock_guard _l(lock);
|
|
data.push(std::move(_));
|
|
ReleaseSemaphore(hsema,1,NULL);
|
|
}
|
|
T pop(){
|
|
WaitForSingleObject(hsema,INFINITE);
|
|
std::lock_guard _l(lock);
|
|
auto _=data.front();
|
|
data.pop();
|
|
return _;
|
|
}
|
|
bool empty(){
|
|
std::lock_guard _l(lock);
|
|
return data.empty();
|
|
}
|
|
}; |