From mboxrd@z Thu Jan 1 00:00:00 1970 From: erik quanstrom Date: Thu, 2 Jan 2014 17:57:54 -0500 To: 9fans@9fans.net Message-ID: In-Reply-To: <88f3a9a7b4b349bbc153cae9e1f0dfde@felloff.net> References: <88f3a9a7b4b349bbc153cae9e1f0dfde@felloff.net> MIME-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Subject: Re: [9fans] devproc noteid changing for none Topicbox-Message-UUID: ab793ef2-ead8-11e9-9d60-3106f5b1d025 On Thu Jan 2 17:54:50 EST 2014, cinap_lenrek@felloff.net wrote: > no. the debug qlock is so the process wont exit. once you hold it, > the process might be running, might be in the process of exiting > might have been already exited or might have been reused. > > the key here is that while you hold it. it wont make it to the > process freelist when not already there. it wont change > from "exiting -> exited". but it wont prevent it from being > reused when it was exited already... but... > > pexit() zeros p->alarm. and p->alarm can not be set to non-zero > value again while we hold the alarms qlock in the kproc! > > so this actually works. > the code says you can set alarm = 0 without holding the alarms lock. ulong procalarm(ulong time) { Proc **l, *f; ulong when, old; if(up->alarm) old = tk2ms(up->alarm - sys->ticks); else old = 0; if(time == 0) { >> up->alarm = 0; >> return old; - erik