3 void callOnMainThread(void (*fn)(), BOOL waitUntilDone) {
4 // NSLog(@"callOnMainThread function at address %p", fn);
5 // Pool is required as we're being called from Java, which probably doesn't have a pool to
6 // allocate the NSValue from.
7 NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
8 [RococoaHelper performSelectorOnMainThread: @selector(callback:)
9 withObject: [NSValue valueWithPointer: fn] waitUntilDone: waitUntilDone];
13 @implementation RococoaHelper : NSObject
15 + (void) callback: (NSValue*) fnAsValue {
16 void (*fn)() = [fnAsValue pointerValue];