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

Re: Time Outs




Hi,

Thanks Doug for your answer.

But I really need to have different threads, I could join two of them but it continues beeing more than one thread.

Perhaps my question should be what are the way to creat a timer/Time out... I know the posix timers but there's another solutions?

Thanks again!


----Original Message Follows----
From: Douglas Allan Tutty <dtutty@porchlight.ca>
To: debian-user@lists.debian.org
Subject: Re: Time Outs
Date: Fri, 27 Apr 2007 19:24:04 -0400

On Fri, Apr 27, 2007 at 04:46:26PM +0000, J HU wrote:
> I'll like some advices about how to create a time out in a debian.

> So I'd like to erase each data after a X seconds and what I'm going to do
> is store in a queue the time when I'd like to erase that data and a pointer
> to the data.
>
Does it have to be within a single thread?  If it was a shell I'd run
"sleep Xs;erase", and similar if I was in python.

The problem with a queue is that for asyncronous input [thread,
processes, whatever], the delay and pointer touples won't be sorted at
all, while ideally they would be sorted by delay.

You could have a separate program that received on stdin touples that it
then turned the delay touple into a specific time-to-erase that then got
sorted.  Stdin could be from a named pipe (fifo) from the async
threads/processes.

I know I'm being process-centric but its been years since I used threads
and then only briefly, but the concept of a program component (separate
thread, separate process, or just a function called by the program's
main loop) that pulls the async touples, orders them into a new fifo,
and then processes any erase-requests that have expired, is valid.

Doug.


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org

_________________________________________________________________
Horóscopo, tarot, numerología... Escucha lo que te dicen los astros. http://astrocentro.msn.es/



Reply to: