in reply to synchronized sub-routine call

sleep has seconds resolution.
Time::HiRes has fractional seconds resolution.

Oh, but if you want the previous function to continue running, and then time out, look at signal handlers: $SIG{ALRM}

See perlipc. Here's an example:

eval { local $SIG{ALRM} = sub { die "alarm clock restart" }; alarm 10; flock(FH, 2); # blocking write lock alarm 0; }; if ($@ and $@ !~ /alarm clock restart/) { die }

Dave

Replies are listed 'Best First'.
Re^2: synchronized sub-routine call
by waswas-fng (Curate) on Jul 26, 2004 at 17:01 UTC
    use Time::HiRes qw( usleep ); subone(); usleep (100); #sleep for 100 ms subtwo(); usleep (100); #sleep for 100 ms ...


    -Waswas
Re^2: synchronized sub-routine call
by b4e (Sexton) on Jul 26, 2004 at 18:21 UTC
    unfortunately flock() won't work on win32.
    i'll have a lock a the corresponding win method