Hey all,

Sorry if this has been answered before, I've been googling and not
coming up with a direct answer to my problem.

I'm working on a (should be) trivial Vote Counter program for a class.
 I've elected to implement the project in Objective-C/Foundation
because I already know how to do something like this in C and I'd like
to learn something new.

I have a VoteList class that multiple threads will be adding votes to.
 I have locks around the code that adds a Vote to the list, so only
one thread can add a Vote at a time.  In testing this class, I'm
trying to start 4 threads that will add some votes to the list so I
can test the locks and make sure everything is getting counted.
Here's the relevant code:

NSLog(@"\n\n========== testVoteList Phase 2 ==========\n\n");
list2 = [[VoteList alloc] init];
NSThread* thread1 = [[NSThread alloc] initWithTarget:self
selector:@selector(phase2:) object:list2];
NSThread* thread2 = [[NSThread alloc] initWithTarget:self
selector:@selector(phase2:) object:list2];
NSThread* thread3 = [[NSThread alloc] initWithTarget:self
selector:@selector(phase2:) object:list2];
NSThread* thread4 = [[NSThread alloc] initWithTarget:self
selector:@selector(phase2:) object:list2];
        
[thread1 start];
[thread2 start];
[thread3 start];
[thread4 start];

The selector(phase2:) is here:

-(void) phase2: (id) arg {
        VoteList* list = arg;
        NSLog(@"Thread checking in...");
        printf("Thread checking in...\n");
        
        return;
}

Everything compiles, and when I run it, the Console tells me that
debugging completed normally.  However, I'm getting nothing in the way
of output from any of the threads:

========== testVoteList Phase 2 ==========


The Debugger has exited with status 0.


Any ideas?

Thanks
-- 
Alex Esplin
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to