Usage: /usr/local/bin/uwsgi [options...] -s|--socket bind to the specified UNIX/TCP socket using default protocol -s|--uwsgi-socket bind to the specified UNIX/TCP socket using uwsgi protocol --http-socket bind to the specified UNIX/TCP socket using HTTP protocol --http-socket-modifier1 force the specified modifier1 when using HTTP protocol --http-socket-modifier2 force the specified modifier2 when using HTTP protocol --fastcgi-socket bind to the specified UNIX/TCP socket using FastCGI protocol --fastcgi-nph-socket bind to the specified UNIX/TCP socket using FastCGI protocol (nph mode) --fastcgi-modifier1 force the specified modifier1 when using FastCGI protocol --fastcgi-modifier2 force the specified modifier2 when using FastCGI protocol --scgi-socket bind to the specified UNIX/TCP socket using SCGI protocol --scgi-nph-socket bind to the specified UNIX/TCP socket using SCGI protocol (nph mode) --scgi-modifier1 force the specified modifier1 when using SCGI protocol --scgi-modifier2 force the specified modifier2 when using SCGI protocol --protocol force the specified protocol for default sockets --socket-protocol force the specified protocol for default sockets --shared-socket create a shared sacket for advanced jailing or ipc --undeferred-shared-socket create a shared sacket for advanced jailing or ipc (undeferred mode) -p|--processes spawn the specified number of workers/processes -p|--workers spawn the specified number of workers/processes --More--
run loop,顾名思义,就是一个循环,你的线程在这里开始,并运行事件处理程序来响应输入事件。你的代码要有实现循环部分的控制语句,换言之就是要有while或for语句。在run loop中,使用run loop对象来运行事件处理代码:响应接收到的事件,启动已经安装的处理程序。
Run loop处理的输入事件有两种不同的来源:输入源(input source)和定时源(timer source)。输入源传递异步消息,通常来自于其他线程或者程序。定时源则传递同步消息,在特定时间或者一定的时间间隔发生。两种源的处理都使用程序的某一特定处理路径。
在苹果官方是这样解释的。
A CFRunLoop object monitors sources of input to a task and dispatches control when they become ready for processing. Examples of input sources might include user input devices, network connections, periodic or time-delayed events, and asynchronous callbacks.
// used by thread2 to force thread exit - (void)forceExit:(ThreadObj*)obj { obj.nExitFlag = 1; NSLog(@"The current forceExit id = %@", self); }
// for thread1 - (void)func1 { nExitFlag = 0; NSLog(@"The current func1 id = %@", self); NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init]; //A runloop with no sources returns immediately from runMode:beforeDate: //That will wake up the loop and chew CPU. Add a dummy source to prevent //it. NSRunLoop *runLoop = [NSRunLoop currentRunLoop]; NSMachPort *dummyPort = [[NSMachPort alloc] init]; [runLoop addPort:dummyPort forMode:NSDefaultRunLoopMode]; [dummyPort release]; [pool release]; while (!nExitFlag){ NSAutoreleasePool *loopPool = [[NSAutoreleasePool alloc] init]; [runLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]; [loopPool drain]; } }
// for thread2 - (void)func2:(NSArray *)args { nExitFlag = 0; NSLog(@"The current func2 id = %@", self); NSThread* thread1 = [args objectAtIndex:1]; id id1 = [args objectAtIndex:0]; // force thread1 to exit [self performSelector:@selector(forceExit:) onThread:thread1 withObject:id1 waitUntilDone:YES]; }
里面就是这样调用了一下,输出的结果是:
1 2 3 4
2013-07-30 10:06:04.714 MyRunLoop[55395:1803] The current func1 id = <ThreadObj: 0x7132590> 2013-07-30 10:06:04.716 MyRunLoop[55395:2003] The current func2 id = <ThreadObj: 0x7132600> 2013-07-30 10:06:04.720 MyRunLoop[55395:1803] The current forceExit id = <ThreadObj: 0x7132600> 2013-07-30 10:06:05.135 MyRunLoop[55395:c07] Application windows are expected to have a root view controller at the end of application launch
是这样子的,你如果自己运行的话,估计会跟我有些区别的。
具体干嘛用,有时间继续 研究,对了还有一个知识点就是:NSMachPort
这个看起来也有大用处,好像跟传递文件有关系
NSMachPort is a subclass of NSPort that can be used as an endpoint for distributed object connections (or raw messaging). NSMachPort is an object wrapper for a Mach port, the fundamental communication port in OS X. NSMachPort allows for local (on the same machine) communication only. A companion class, NSSocketPort, allows for both local and remote distributed object communication, but may be more expensive than NSMachPort for the local case.
I="0 1 2 3 4 5 6 7 8 9 a b c d e f" for acm in$I; do for x in$I; do mkdir -p /tmp/session/$acm/$x; done; done chown -R nobody:nobody /tmp/session chmod -R 1777 /tmp/session