Luigi Auriemma

aluigi.org (ARCHIVE-ONLY FORUM!)
It is currently 19 Jul 2012 14:42

All times are UTC [ DST ]





Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 
Author Message
 Post subject: [question] wait/delay function
PostPosted: 14 Jun 2009 01:38 

Joined: 24 Oct 2007 00:44
Posts: 26
I tried making a delay() function, but it just suspends the program like sleep().
Any way around this? Any alternatives to the sleep() function? Something that doesn't suspend the program?


Top
 Profile  
 
 
 Post subject: Re: [question] wait/delay function
PostPosted: 14 Jun 2009 09:57 

Joined: 13 Aug 2007 21:44
Posts: 4068
Location: http://aluigi.org
ehmmm obviously depends by the context where you want to apply this delay.
for example in a multi-thread environment (like a tcp server) the usage of sleep() blocks the thread and not the whole program.
while in other fields this can be far from being easy.
imagine the delaying of sendto which obviously is not possible with a simple sleep() but requires to buffer the packet(s) and sending it when the whole loop of the function reaches the desired time.
and this is the same also if you use a proxy, the only thing which changes is that if you can't modify the source of the main program you can modify the proxy.

anyway I implemented this thing in a basic and quick way (based on the number of packets and not on the elapsed time) as a plugin for proxocket, maybe take a look at it:
sendto-lagger-t856.html


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 2 posts ] 

All times are UTC [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for: