This is Counter.m in view mode; [Download] [Up]
#import "Counter.h" #import <threadkit/threadkit.h> @implementation Counter - awakeFromNib { thread = [ [ TKThread alloc ] initFor: self perform: @selector ( startCounter ) ] ; return self ; } - startCounter { while ( 1 ) { counter = 0 ; while ( counter <= 100 ) { [ TKThread yield ] ; [ NXApp threadLock ] ; [ target setIntValue: counter ] ; [ NXApp threadUnlock ] ; counter++ ; } sleep ( 2 ) ; } } - suspend: sender { [ thread threadLock ] ; return self ; } - resume: sender { [ thread threadUnlock ] ; return self ; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.