bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH] Add timeout utility


From: Bo Borgerson
Subject: Re: [PATCH] Add timeout utility
Date: Wed, 2 Apr 2008 10:54:08 -0400

On Wed, Apr 2, 2008 at 10:20 AM, Pádraig Brady <address@hidden> wrote:
>  It will always go through though as the kernel will buffer it.

Yes, that introduces some fuzz, but I think the principle remains
viable -- the kernel will only buffer so much.

Consider the following using a timeout.c modified with the attached
patch, and a small Perl program (below) than hangs after 10 seconds:

$ time yes | src/timeout -i 2s ./write_then_hang 10 >/dev/null

real    0m11.777s
user    0m0.656s
sys     0m0.068s

Bo

-- Perl --

#!/usr/bin/perl -w

my $n = shift @ARGV || 10;

my $s = time;

print scalar(<STDIN>) while (time - $s < $n);

while(1){ }

Attachment: timeout.c.diff
Description: Text Data


reply via email to

[Prev in Thread] Current Thread [Next in Thread]