in reply to Joining a Thread in w While loop
Pseudo-code for the select solution:
my $sel = new IO::Select; $sel->add($sock); while (1) { if ($sel->can_read(1)) { # 1 second timeout # do read, appending to buffer sysread($sock, $buf, 1024, length($buf)); # check for a complete line, process command, etc. } last if ($die); }
Update: Why can't you detach the thread? You're not returning any values from it. If you need to you can have it signal its completion by setting a shared variable.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Joining a Thread in w While loop
by deadpickle (Pilgrim) on Mar 05, 2008 at 15:31 UTC | |
by pc88mxer (Vicar) on Mar 05, 2008 at 16:20 UTC | |
by deadpickle (Pilgrim) on Mar 05, 2008 at 19:57 UTC | |
by zentara (Cardinal) on Mar 05, 2008 at 20:23 UTC | |
by deadpickle (Pilgrim) on Mar 05, 2008 at 21:14 UTC | |
|