Re: Thread crashing problem
Re: Thread crashing problem
- Subject: Re: Thread crashing problem
- From: Scott Ribe <email@hidden>
- Date: Mon, 22 Dec 2008 09:40:48 -0700
- Thread-topic: Thread crashing problem
> Given that, could you give a really simple example of how to
> coordinate access between the three methods?
First, your lock is an instance variable of the class, so in init you alloc
& init it, and in dealloc you release it...
- (void) methodA
{
[myLock tryLockBeforeDate: [NSDate distantFuture]];
// do your stuff here
[myLock unlock];
}
- (void) methodB
{
[myLock tryLockBeforeDate: [NSDate distantFuture]];
// do your stuff here
[myLock unlock];
}
- (void) methodC
{
[myLock tryLockBeforeDate: [NSDate distantFuture]];
// do your stuff here
[myLock unlock];
}
--
Scott Ribe
email@hidden
http://www.killerbytes.com/
(303) 722-0567 voice
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden