提交 681d3648 authored 作者: kongdywang's avatar kongdywang

Fix the potential multi-concurrency issues that may arise from high-concurrency…

Fix the potential multi-concurrency issues that may arise from high-concurrency callback messages in native iOS
上级 95a2950a
...@@ -48,6 +48,7 @@ ...@@ -48,6 +48,7 @@
- (void)flushIfNeed - (void)flushIfNeed
{ {
@synchronized(self) {
if (self.eventSink == nil) { if (self.eventSink == nil) {
return; return;
} }
...@@ -58,11 +59,14 @@ ...@@ -58,11 +59,14 @@
self.eventSink(obj); self.eventSink(obj);
} }
[self.eventQueue removeAllObjects]; [self.eventQueue removeAllObjects];
}
} }
- (void)enqueue:(NSObject *)event - (void)enqueue:(NSObject *)event
{ {
@synchronized (self) {
[self.eventQueue addObject:event]; [self.eventQueue addObject:event];
}
} }
@end @end
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论