site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; bh=6I3rYpoJtw4ehVKPhtLutaQvRpGVKVI2I7x7T4cAIGE=; b=E2je5qYtAIwmIkShK0BLUqRyAH1iA/ezNV6DjJgMEVBcWfAfVxQXeZ05mEoDDFBGq0 A5/0sQ2zMqQZy3RCcwI3LfCH1XiYz1rakKF7qNDmLSLgZaPhEka8JiIbIbjmXV3Gb/zp xSxxpwlam7u/711yjKGmId29biUCfQkI7D+l0= On Fri, Sep 23, 2011 at 7:45 AM, Ken Hornstein <kenh@cmf.nrl.navy.mil> wrote:
I am porting windows code to MAC. In Windows we haveKeWaitForMultipleObjects(), which puts the current thread to wait state until any or all of a number of dispatcher objects are set to a signaled state or (optionally) until the wait times out. My requirement is I need to wait for 2 events at a time until one of them issignaled. In mac we doesn't have events, one of the option is msleep, can anyone suggest any alternatives?
When you say "objects", you're talking about your own code, right?
Objects (in this case) on Windows are things like: Mutexes ; Events ; Processes ; Timers ; Files etc. Pretty much anything with a HANDLE. (caps intended. Windows devs love caps ) A list of HANDLEs can be provided to this routine (similarly: the user space routines) to wait for any of the objects to signal. I suppose the closest *NIX has to Window's Objects & HANDLEs are file descriptors. Though these are not directly equivalent. You need to consider type of objects being waited for to decide what synchronization primitive to use. What are these 2 objects? Cheers, Corey See here for some documentation on WaitForMultipleObjects: http://msdn.microsoft.com/en-us/library/windows/desktop/ms687025(v=vs.85).as... _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-kernel mailing list (Darwin-kernel@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-kernel/site_archiver%40lists.a... This email sent to site_archiver@lists.apple.com