Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /var/www/html/extensions/Variables/includes/ExtVariables.php on line 198
CPMIGServerSource - iPhone Development Wiki


From iPhone Development Wiki

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);


External links