Hello Paul,

> I think tou mean "sending a message" here to block the program flow a while.

Not exacly. If you use SendMessage to a message pump for a window
created in the same thread contextt then it is just a function call. If
other thread context then it will block until the thread has timeslice.

But if you use PostMessage to same thread context. and IN your custom
message handler you do your next operation, then you have a very small
delay without hanging up the message pump for this thread.

If you want to block the program flow then you can also use a close
loop. But no message will be processed in the same thread context during
the loop and I don't think that was what you wanted.

Rgds, Wilfried [TeamICS]

Tuesday, January 27, 2009, 12:56, Paul wrote:

> Hi Wilfried,

>> You could do very small delays by posting a message to a custom message
>> handler. You cannot measure the delay, but it is not depending the
>> timeslice like with the other delay's or a TTimer.

> I think tou mean "sending a message" here to block the program flow a while.

> I use a queue with all instructions that have to be sent to the server.
> The HttpCli runs in async mode and when a instruction has been sent, it
> posts a message to check the queue from there, the next instruction will be
> sent.
> I can check the speed of the connection as the time between start and end of
> the transfer with QueryPerformanceCounter.
> All instructions to send are pretty similar, so the the connection speed can
> be estimated this way.
> I have no problem with the timeslice, but with the 2ms delay.
> If I use the delay methods I listed before, the delay is always 0 or 15 ms.
> The 15 ms is just the timeslice, so the delay isn't working at all with such
> short periods.
> As I replied to Angus, including a software delay (checking the 
> QueryPerformanceCounter) increases the cpu load a lot.

> Paul 

To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be

Reply via email to