*nix tail -f multiple log files with Thread

Jarkko Torppa torppa at staff.megabaud.fi
Fri Feb 13 23:50:57 CET 2009


On 2009-02-13, Christian Heimes <lists at cheimes.de> wrote:
> David schrieb:
>> Hi everyone,
>> 
>> I copied a program from C to track multiple log files. I would like to
>> be able to print a label when a log file is updated. Here is the program;
>
> Don't use threads for the job. On Unix the preferred way is select()'ing
> or poll()'ing multiple file descriptors.

     File descriptors associated with regular files always select
     true  for  ready  to  read, ready to write, and error condi-
     tions.

     Regular files always poll TRUE for reading and writing.

You have to either sleep or use kevent/completion/...

-- 
Jarkko Torppa, Elisa



More information about the Python-list mailing list