macOS/iOS API解説

iOS , Mac アプリケーション開発のために使われる主要フレームワークの日本語情報です。2010年代に書かれた内容です。今後更新はありません。

目次

setThreadPriority:

スレッドの優先度をセットします
+(BOOL)setThreadPriority:(double)priority:

解説

スレッドの優先度をセットします。0.0〜1.0まで

返り値

( BOOL )

YES/NO

引数

( double )priority

クラス

NSThread

Class Methods

使用可能

10.2

参照

+ currentThread
+ sleepUntilDate:

例文

#import "MyObject.h"

@implementation MyObject

- (IBAction)myAction:(id)sender
{
[NSThread detachNewThreadSelector:@selector(threadTask) toTarget:self
withObject:nil];
[NSThread setThreadPriority:0.6];
NSLog([NSString stringWithFormat:@"%f",[NSThread threadPriority]]);

}
- (void)threadTask
{
    int i;
    NSAutoreleasePool *pool = [NSAutoreleasePool new];

  for (i=1;i<100;i++) {
    NSLog([NSString stringWithFormat:@"%d",i]);
    }

    [pool release];
    [NSThread exit];
}
@end