• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Multi-threaded help
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Multi-threaded help


  • Subject: Multi-threaded help
  • From: Steve Walter <email@hidden>
  • Date: Wed, 7 Mar 2007 22:48:17 +0000

Hi everyone.
I am trying this new game: multi-threaded programming.
After I went through whole apple's document, I tried to produce some result . However, I failed.
I wrote an application , whose function is: at first it creates a thread, then it uses a nstimer to wake the thread and order the thread to printf a statement to the console every second.
Really need someone help me to clarify my following code:



#import "AppControl.h"

@implementation AppControl

- (IBAction)go:(id)sender
{

eventTimer = [[NSTimer timerWithTimeInterval:1.0
target:self
selector:@selector(fireTimer:)
userInfo:nil
repeats:YES] retain];

[NSThread detachNewThreadSelector:@selector(runLoop:)
toTarget:self
withObject:nil];
[evenTimer fire];
}
-(void)runLoop:(id) sender{

NSAutoreleasePool * myPool;
myPool = [[NSAutoreleasePool alloc] init];
[[NSRunLoop currentRunLoop] addTimer:eventTimer forMode:NSDefaultRunLoopMode];
[myPool release];
}
-(void) fireTimer:(id) sender{
printf("In the fire timer function\n");
}


@end

I am excepting to see something in the console. God is kidding me - completely blank.
Really NEED YOUR HELP. THANK YOU IN ADVANCE.


_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Multi-threaded help
      • From: "stephen joseph butler" <email@hidden>
  • Prev by Date: Intercept keydown in edited cell
  • Next by Date: call scrollRangeToVisible in multi-threads cause application dead lock
  • Previous by thread: Re: Intercept keydown in edited cell
  • Next by thread: Re: Multi-threaded help
  • Index(es):
    • Date
    • Thread