Yes, I did mean thread, and I hadn't realized this would kill all the
threads. I'll try with ioproc then, thanks for the example.
Mathieu
--- Begin Message ---
If you really mean thread and not proc, then what you suggest won't work.
You can't kill a thread that's in the OS without killing the proc
conyaining the thread (thereby killing all the other threads as well).
You can have the proc catch notes and send a note to the proc which
will interrupt any system call, thereby pulling the thread out of
the dial.
A more elgant way to do this would be to use ioproc(2), or to
create procs explicitly to do the dial I/O.
Sape
> From: lejat...@gmail.com
> To: 9fans@9fans.net
> Reply-To: 9fans@9fans.net
> Date: Thu Sep 10 11:38:50 CES 2009
> Subject: [9fans] dial and time out
>
> Hello 9fans,
>
> I have a bunch of threads, simply scheduled with yield() at the moment
> (I'll use alt later on), and each of them is calling dial() at some
> point. I don't want the other threads to wait for "too long" when one
> of them is blocked on a dial() that will eventually time out.
> So I was thinking, for each of them, of creating a proc which would
> be used as a timer; it would be created just before the call to dial,
> wait for some time, and then kill the dial()ing thread. And as mechiel
> suggested, the dial()ing thread would also be set to kill the timer
> after it successfully dialed, hence not being killed if it was fast
> enough.
>
> Is that the right way to go? If yes, can anyone think of an already
> existing example I can look at?
>
> Mathieu
>
--- End Message ---