* [9fans] exiting nicely
@ 2009-09-30 7:46 gdiaz
0 siblings, 0 replies; 3+ messages in thread
From: gdiaz @ 2009-09-30 7:46 UTC (permalink / raw)
To: 9fans
hello
I have a couple of processes working together sharing memory and using locks, and when the program finish the job and exits, the proceses in Rendez state does not exit, and i need to slay them.
I'm using postnote(PNGROUP,...) call, should i write a postctl to slay the waiting proceses or is there a better way to accomplish this? (may be using canlock and wait for it with a loop and sleep instead of a qlock?)
thanks
gabi
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9fans] exiting nicely
[not found] <<9d12d327612343c13bd110253c2632c6@9grid.es>
@ 2009-09-30 13:25 ` erik quanstrom
2009-09-30 13:57 ` gdiaz
0 siblings, 1 reply; 3+ messages in thread
From: erik quanstrom @ 2009-09-30 13:25 UTC (permalink / raw)
To: 9fans
> I have a couple of processes working together sharing memory and using locks, and when the program finish the job and exits, the proceses in Rendez state does not exit, and i need to slay them.
>
> I'm using postnote(PNGROUP,...) call, should i write a postctl to slay the waiting proceses or is there a better way to accomplish this? (may be using canlock and wait for it with a loop and sleep instead of a qlock?)
looping on canq?lock is not a good idea.
i think what you want is to ensure that no proc is
doing anything that shouldn't be interrupted when
it is killed or quits. for many programs, interrupting
writes is a bad idea. one would want a half-written
upas index file, for instance. rc checks a global sentinal at
a few strategic points (where it can clean up easily)
when it receives a signal. perhaps you could borrow
this technique, as in
/*
* exit the building single file
*/
void
chkexit(QLock *q)
{
if(!exiting)
return;
qunlock(q)
cleanexit();
}
...
qlock(&resourcelk);
chkexit(&resourcelk);
...
qunlock(&resourcelk);
this might not be appropriate. the bad things
that might happen if your interrupted in the
middle of something might not be bad enough
to worry about or this might be difficult to implement
with your program.
- erik
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [9fans] exiting nicely
2009-09-30 13:25 ` [9fans] exiting nicely erik quanstrom
@ 2009-09-30 13:57 ` gdiaz
0 siblings, 0 replies; 3+ messages in thread
From: gdiaz @ 2009-09-30 13:57 UTC (permalink / raw)
To: 9fans
hello
i think i'll do the checkexit() and doublecheck again all exiting procs unlocks all the locks they had, as the only place to check is when a proc is waiting to read from the 9p pipe:
qlock(&iorlock);
n = read9pmsg(mfd[0], io->mdata, messagesize);
qunlock(&iorlock);
thanks!
gabi
>> I have a couple of processes working together sharing memory and using locks, and when the program finish the job and exits, the proceses in Rendez state does not exit, and i need to slay them.
>>
>> I'm using postnote(PNGROUP,...) call, should i write a postctl to slay the waiting proceses or is there a better way to accomplish this? (may be using canlock and wait for it with a loop and sleep instead of a qlock?)
>
> looping on canq?lock is not a good idea.
>
> i think what you want is to ensure that no proc is
> doing anything that shouldn't be interrupted when
> it is killed or quits. for many programs, interrupting
> writes is a bad idea. one would want a half-written
> upas index file, for instance. rc checks a global sentinal at
> a few strategic points (where it can clean up easily)
> when it receives a signal. perhaps you could borrow
> this technique, as in
>
> /*
> * exit the building single file
> */
> void
> chkexit(QLock *q)
> {
> if(!exiting)
> return;
> qunlock(q)
> cleanexit();
> }
> ...
> qlock(&resourcelk);
> chkexit(&resourcelk);
> ...
> qunlock(&resourcelk);
>
> this might not be appropriate. the bad things
> that might happen if your interrupted in the
> middle of something might not be bad enough
> to worry about or this might be difficult to implement
> with your program.
>
> - erik
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2009-09-30 13:57 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <<9d12d327612343c13bd110253c2632c6@9grid.es>
2009-09-30 13:25 ` [9fans] exiting nicely erik quanstrom
2009-09-30 13:57 ` gdiaz
2009-09-30 7:46 gdiaz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).