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 [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]