提交 1c23b2b0 编写于 作者: A anashaty

8080504: [macosx] SunToolkit.realSync() may hang

Reviewed-by: serb, prr
上级 877a0227
......@@ -137,7 +137,7 @@ JNIEXPORT jboolean JNICALL Java_sun_lwawt_macosx_LWCToolkit_nativeSyncQueue
if ([sharedApp isKindOfClass:[NSApplicationAWT class]]) {
NSApplicationAWT* theApp = (NSApplicationAWT*)sharedApp;
[theApp postDummyEvent];
[theApp waitForDummyEvent];
[theApp waitForDummyEvent:timeout];
} else {
// could happen if we are embedded inside SWT application,
// in this case just spin a single empty block through
......
......@@ -38,7 +38,7 @@
- (void) setDockIconWithEnv:(JNIEnv *)env;
- (void) postDummyEvent;
- (void) postRunnableEvent:(void (^)())block;
- (void) waitForDummyEvent;
- (void) waitForDummyEvent:(long long) timeout;
+ (void) runAWTLoopWithApp:(NSApplication*)app;
......
......@@ -397,8 +397,14 @@ AWT_ASSERT_APPKIT_THREAD;
[pool drain];
}
- (void)waitForDummyEvent {
[seenDummyEventLock lockWhenCondition:YES];
- (void)waitForDummyEvent:(long long) timeout {
if (timeout >= 0) {
double sec = ((double) timeout)/1000;
[seenDummyEventLock lockWhenCondition:YES
beforeDate:[NSDate dateWithTimeIntervalSinceNow:sec]];
} else {
[seenDummyEventLock lockWhenCondition:YES];
}
[seenDummyEventLock unlock];
[seenDummyEventLock release];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册