9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] thread cleanup
@ 2006-09-06 18:34 Skip Tavakkolian
  2006-09-06 20:20 ` Russ Cox
  0 siblings, 1 reply; 3+ messages in thread
From: Skip Tavakkolian @ 2006-09-06 18:34 UTC (permalink / raw)
  To: 9fans

in an fs i wrote that's using thread library, the parent can't kill the child.
the child was started by proccreate and is in Rendez state; the thread
in the child is running a function that waits on a channel (recvp);

in fs.end(), i've tried threadexitsall, threadkill, and postnote --
PNPROC and PNGROUP -- but nothing worked.  what am i missing?

child process state:
cpu% acid 698004
/proc/698004/text:386 plan 9 executable

/sys/lib/acid/port
/sys/lib/acid/386
acid: stk()
rendezvous()+0x7 /sys/src/libc/9syscall/rendezvous.s:5
runthread(p=0x29a48)+0x83 /sys/src/libthread/sched.c:144
_sched()+0x90 /sys/src/libthread/sched.c:113
_schedinit(arg=0x29a48)+0x1a4 /sys/src/libthread/sched.c:77
main(argc=0x4,argv=0x7fffef9c)+0x38 /sys/src/libthread/main.c:34
_main+0x31 /sys/src/libc/386/main9.s:16
acid: 



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] thread cleanup
  2006-09-06 18:34 [9fans] thread cleanup Skip Tavakkolian
@ 2006-09-06 20:20 ` Russ Cox
  2006-09-06 22:11   ` Skip Tavakkolian
  0 siblings, 1 reply; 3+ messages in thread
From: Russ Cox @ 2006-09-06 20:20 UTC (permalink / raw)
  To: Fans of the OS Plan 9 from Bell Labs

threadexitsall should take it down (and everything else).
don't use threadkill or postnote.  instead send the thread
something on the channel it's waiting on (like a nil)
indicating that it should exit cleanly.

i'm very surprised that threadexitsall doesn't work.
if you can create a simple test program demonstrating
a hang after threadexitsall, i'd like to see it.

russ


On 9/6/06, Skip Tavakkolian <9nut@9netics.com> wrote:
> in an fs i wrote that's using thread library, the parent can't kill the child.
> the child was started by proccreate and is in Rendez state; the thread
> in the child is running a function that waits on a channel (recvp);
>
> in fs.end(), i've tried threadexitsall, threadkill, and postnote --
> PNPROC and PNGROUP -- but nothing worked.  what am i missing?
>
> child process state:
> cpu% acid 698004
> /proc/698004/text:386 plan 9 executable
>
> /sys/lib/acid/port
> /sys/lib/acid/386
> acid: stk()
> rendezvous()+0x7 /sys/src/libc/9syscall/rendezvous.s:5
> runthread(p=0x29a48)+0x83 /sys/src/libthread/sched.c:144
> _sched()+0x90 /sys/src/libthread/sched.c:113
> _schedinit(arg=0x29a48)+0x1a4 /sys/src/libthread/sched.c:77
> main(argc=0x4,argv=0x7fffef9c)+0x38 /sys/src/libthread/main.c:34
> _main+0x31 /sys/src/libc/386/main9.s:16
> acid:
>
>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [9fans] thread cleanup
  2006-09-06 20:20 ` Russ Cox
@ 2006-09-06 22:11   ` Skip Tavakkolian
  0 siblings, 0 replies; 3+ messages in thread
From: Skip Tavakkolian @ 2006-09-06 22:11 UTC (permalink / raw)
  To: 9fans

> don't use threadkill or postnote.

thanks Russ.  i caused the problem with a postnote.  the fs.write
service routine that handled the 'exit' request, was posting a kill
note to itself (proc that srv was running in), ahead of calling the
fs.end function.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2006-09-06 22:11 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-06 18:34 [9fans] thread cleanup Skip Tavakkolian
2006-09-06 20:20 ` Russ Cox
2006-09-06 22:11   ` Skip Tavakkolian

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).