site_archiver@lists.apple.com Delivered-To: darwin-kernel@lists.apple.com I feel a bit silly responding to my own posting, but I think I figured it out and thought I'd see if I got it right: In various places in the xnu kernel I see code like the following: #1 msleep(<event>, my_mutex, PDROP, "mysleep", 0); lck_mtx_lock(my_mutex); So, why do the above instead of: #2 msleep(<event>, my_mutex, 0, "mysleep", 0); My understanding was that msleep() would release the mutex and then re-acquire it, if PDROP isn't specified. #1 - always releases/acquires the mutex, allowing other threads wanting the mutex to get a turn #2 - holds the mutex unless it sleeps Does this make sense (ie. #1 is used to give other threads a chance to lock the mutex even if the msleep() doesn't actually sleep)? Still seems a little weird to call msleep() unless you need to sleep. Again, thanks in advance for any info, rick _______________________________________________ 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... Is there any fundamental difference between door #1 and door #2? This email sent to site_archiver@lists.apple.com
participants (1)
-
Rick Macklem