Re: Mutex and Sleep

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Rajendra Stalekar spiffera, alle Tuesday 17 July 2007 circa:
> which implies that if no lock is acquired it would sleep till it gets
> it.

I think you're quite confused, and that's a bad thing if you make confused 
other people.

1) migth_sleep doesn't have anything to do with mutex, if you control it's 
defined in kernel/sched.c:7101 (kernel 2.6.21.1).
it only tells if that call is in a context that is allowed to sleep, but 
DON'T sleep.

2) the function that "sleep" in this case is the mutex itself. 
if you go through the function calls, you see that you arrive in 
mutex_lock_common, that has a 
for (;;) {... acquire code ... }
that at near end calls schedule() that _can_ sleeps... :P

Bye!
-- 
-gaspa-
-----------------------------------------------
--------- Powered by Debian GNU/Linux ---------
------ HomePage: iogaspa.altervista.org -------
-Il lunedi'dell'arrampicatore: www.lunedi.org -

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux