PTLib  Version 2.10.11
MacMainIf.h
Go to the documentation of this file.
1 //
2 //
3 // Upper interface declarations for MacMain functions
4 //
5 #ifndef MACMAINIF_H_
6 #define MACMAINIF_H 1
7 
8 // This embarassing hack exists purely because EMACS' electric-c indentation
9 // mode is too clever by half...
10 #ifdef __cplusplus
11 #define BEGIN_EXTERN_C extern "C" {
12 #define END_EXTERN_C };
13 #else
14 #define BEGIN_EXTERN_C
15 #define END_EXTERN_C
16 #endif
17 
18 #include <CoreServices/CoreServices.h>
19 
21 
22 long MacInitialisePWLibEvents(void);
23 long MacTeardownPWLibEvents(void);
24 // technically, CALLBACK_API_C returns OSStatus, but that's a long
25 typedef long(*callback_api_c)(void*);
26 int SpawnProcessInContext( callback_api_c trampoline );
27 // The shutdown dance is long and complicated.
28 // Actually, it's not. When (or shortly after) the PProcess terminates,
29 // three things happen:
30 // The extern variable pwlibAppQueueID gets set to zero;
31 // the main application event loop receives a special event call;
32 // and the main application receives a Quit event.
33 // Here's the special event:
34 #define kEventClassPwlib 'PWLB'
35 #define kEventPwlibPProcExit 0
36 // Here's the variable:
37 extern MPQueueID pwlibAppQueueID;
38 // And here's a function you can call to wait for the application PProcess
39 // to exit (assuming you've already suggested to it that it should).
40 long MacWaitForPProcess(Duration);
41 
43 #endif
long(* callback_api_c)(void *)
Definition: MacMainIf.h:25
#define BEGIN_EXTERN_C
Definition: MacMainIf.h:14
long MacTeardownPWLibEvents(void)
#define END_EXTERN_C
Definition: MacMainIf.h:15
int SpawnProcessInContext(callback_api_c trampoline)
BEGIN_EXTERN_C long MacInitialisePWLibEvents(void)
MPQueueID pwlibAppQueueID
long MacWaitForPProcess(Duration)