MythTV master
mythcocoautils.mm
Go to the documentation of this file.
1// MythTV
3
4// OSX
5#import <Cocoa/Cocoa.h>
6
7// Dummy NSThread for Cocoa multithread initialization
8@implementation NSThread (Dummy)
9
10 - (void) run
11{
12}
13
14@end
15
17{
18 // Cocoa requires a message to be sent informing the Cocoa event
19 // thread that the application is multi-threaded. Apple recommends
20 // creating a dummy NSThread to get this message sent.
21 if (![NSThread isMultiThreaded])
22 {
23 NSThread *thr = [[NSThread alloc] init];
24 SEL threadSelector = @selector(run);
25 [NSThread detachNewThreadSelector:threadSelector
26 toTarget:thr
27 withObject:nil];
28 }
29
30 NSAutoreleasePool *pool = nullptr;
31 pool = [[NSAutoreleasePool alloc] init];
32 return pool;
33}
34
35void DeleteOSXCocoaPool(void* &pool)
36{
37 if (pool)
38 {
39 NSAutoreleasePool *a_pool = (NSAutoreleasePool*) pool;
40 pool = nullptr;
41 [a_pool release];
42 }
43}
void * CreateOSXCocoaPool(void)
void DeleteOSXCocoaPool(void *&pool)
void run(const QString &name, Class *object, void(Class::*fn)())
Definition: mconcurrent.h:137