Notifications and timing
Notifications and timing
- Subject: Notifications and timing
- From: "McLaughlin, Michael P." <email@hidden>
- Date: Thu, 12 Mar 2009 13:46:19 -0400
- Acceptlanguage: en-US
- Thread-topic: Notifications and timing
I have a "global" gFlags variable (unsigned long long) and several objects
that need a pointer to it. I fill one such pointer, and reinit gFlags, via
the following code:
if (flags == nil) {
flagPtr *flgH = &flags;
NSData *flgsDatum =
[[NSData alloc] initWithBytesNoCopy:flgH length:sizeof(flgH)
freeWhenDone:NO];
[[NSNotificationCenter defaultCenter] postNotificationName:@"fetchFlags"
object:flgsDatum];
*flags = (WORKING | (*flags & LOGFILE));
}
This code appears to work successfully. My question is whether the
notification is responded to in a synchronous manner so that the pointer is
guaranteed to be filled in by the time
*flags = (WORKING | (*flags & LOGFILE));
is executed.
If not, is there a better way to do this? The object containing the code
shown above knows nothing about the object containing gFlags (not even its
header) and I would like to keep it that way, if possible.
--
Mike McLaughlin
_______________________________________________
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