(Created page with 'CPMIGServerSource is a CF class that creates a convenient function to hook a MIG-generated subsystem to a run loop. == Example code == <source lang="c"> #include <GraphicsSe…') |
m (Reordering) |
||
Line 2: | Line 2: | ||
== Example code == | == Example code == | ||
<source lang="c"> | <source lang="c"> | ||
#include <GraphicsServices/GSEvent.h> | #include <GraphicsServices/GSEvent.h> | ||
Line 26: | Line 27: | ||
</source> | </source> | ||
== | == External links == | ||
{{ | {{IPFHeader|AppSupport}} |
Latest revision as of 16:32, 26 October 2014
CPMIGServerSource is a CF class that creates a convenient function to hook a MIG-generated subsystem to a run loop.
Example code
#include <GraphicsServices/GSEvent.h>
#include <AppSupport/CPMIGServerSource.h>
#include <CoreFoundation/CoreFoundation.h>
#include <mach/mach.h>
#include "myMIGSubsys.h"
extern struct mig_subsystem myMIGSubsys_subsystem;
...
mach_port_t port = GSRegisterPurpleNamedPort("com.yourcompany.myMIGSubsys");
struct mach_port_limits queueSize = {16};
kern_return_t err = mach_port_set_attributes(mach_task_self(), port, MACH_PORT_LIMITS_INFO, &queueSize, 1);
if (err) {
CFLog(kCFLogLevelWarning, CFSTR("Cannot set queue size: %s\n"), mach_error_string(err));
}
CPMIGServerSourceRef source = CPCreateMIGServerSource(&myMIGSubsys_subsystem, port, 0);
CFRunLoopAddSource(CFRunLoopGetCurrent(), source, kCFRunLoopCommonModes);
CFRelease(source);
...
External links
- Header: http://github.com/kennytm/iphone-private-frameworks/blob/master/AppSupport/CPMIGServerSource.h
|