mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-08-24 16:09:22 +00:00
Revised synchronization
This commit is contained in:
@ -57,13 +57,13 @@ public:
|
||||
~synchronized_callback() { *this = nullptr; }
|
||||
|
||||
synchronized_callback &operator=(std::function<void(P...)> func) {
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||
std::lock_guard lock(mutex);
|
||||
callback = func;
|
||||
return *this;
|
||||
}
|
||||
|
||||
void operator()(P... args) const {
|
||||
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||
std::lock_guard lock(mutex);
|
||||
if (callback)
|
||||
callback(args...);
|
||||
}
|
||||
|
Reference in New Issue
Block a user