summaryrefslogtreecommitdiff
path: root/delegateuitask_darwin.m
diff options
context:
space:
mode:
authorPietro Gagliardi <[email protected]>2014-07-03 11:53:21 -0400
committerPietro Gagliardi <[email protected]>2014-07-03 11:53:21 -0400
commitb460466e4b7d479a015bb686adb42056ef189abe (patch)
treef2b729088df05276473d291a70e7bdc785ebe998 /delegateuitask_darwin.m
parent1287ba89682b98b4196db7b9f81569f2abdb5761 (diff)
Implemented Post() on Mac OS X.
Diffstat (limited to 'delegateuitask_darwin.m')
-rw-r--r--delegateuitask_darwin.m19
1 files changed, 19 insertions, 0 deletions
diff --git a/delegateuitask_darwin.m b/delegateuitask_darwin.m
index a1f9501..94051c0 100644
--- a/delegateuitask_darwin.m
+++ b/delegateuitask_darwin.m
@@ -56,6 +56,13 @@ extern NSRect dummyRect;
@implementation appDelegate
+- (void)uipost:(id)pv
+{
+ NSValue *v = (NSValue *) pv;
+
+ appDelegate_uipost([v pointerValue]);
+}
+
- (BOOL)windowShouldClose:(id)win
{
return appDelegate_windowShouldClose(win);
@@ -123,6 +130,18 @@ BOOL initCocoa(id appDelegate)
return YES;
}
+void uipost(id appDelegate, void *data)
+{
+ // need an autorelease pool here
+ NSAutoreleasePool *pool;
+
+ pool = [NSAutoreleasePool new];
+ [appDelegate performSelectorOnMainThread:@selector(uipost:)
+ withObject:[NSValue valueWithPointer:data]
+ waitUntilDone:YES]; // note this bit; see uitask_darwin.go for details
+ [pool release];
+}
+
void breakMainLoop(void)
{
NSEvent *e;