Fabric: Lock-free events 3/n: EventEmitter::DispatchMutex is not recursive mutex anymore
Summary: The mutex is a "leaf" mutex, so the code cannot reenter that, so there is no reason to be a recursive one. Reviewed By: sahrens Differential Revision: D13642592 fbshipit-source-id: 0fb64d3405c5d3408251dc983c186f6747bc6ee2
This commit is contained in:
parent
b1814b37aa
commit
97f9e4082c
|
@ -31,8 +31,8 @@ static std::string normalizeEventType(const std::string &type) {
|
|||
return prefixedType;
|
||||
}
|
||||
|
||||
std::recursive_mutex &EventEmitter::DispatchMutex() {
|
||||
static std::recursive_mutex mutex;
|
||||
std::mutex &EventEmitter::DispatchMutex() {
|
||||
static std::mutex mutex;
|
||||
return mutex;
|
||||
}
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ class EventEmitter {
|
|||
using Tag = int32_t;
|
||||
|
||||
public:
|
||||
static std::recursive_mutex &DispatchMutex();
|
||||
static std::mutex &DispatchMutex();
|
||||
|
||||
static ValueFactory defaultPayloadFactory();
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ void EventQueue::onBeat(jsi::Runtime &runtime) const {
|
|||
}
|
||||
|
||||
{
|
||||
std::lock_guard<std::recursive_mutex> lock(EventEmitter::DispatchMutex());
|
||||
std::lock_guard<std::mutex> lock(EventEmitter::DispatchMutex());
|
||||
|
||||
for (const auto &event : queue) {
|
||||
if (event.eventTarget) {
|
||||
|
|
|
@ -155,7 +155,7 @@ void ShadowTree::emitLayoutEvents(
|
|||
|
||||
void ShadowTree::toggleEventEmitters(
|
||||
const ShadowViewMutationList &mutations) const {
|
||||
std::lock_guard<std::recursive_mutex> lock(EventEmitter::DispatchMutex());
|
||||
std::lock_guard<std::mutex> lock(EventEmitter::DispatchMutex());
|
||||
|
||||
for (const auto &mutation : mutations) {
|
||||
if (mutation.type == ShadowViewMutation::Create) {
|
||||
|
|
Loading…
Reference in New Issue