Re: [twsocket] Large amount of OnDataAvailable calls and timer/frozen main thread

2006-10-31 Thread Markus Humm
Hello,

I tried the direct calling of the timer without succes (I think some of
the affected VCL-components [like ListView and JvSimScope from JEDI]
need windows messages for their updating as well).

I also tried the thread based approach but without success. If I pack
the ICS communication into a thread I can connect but the rest doesn't
work. The thread looks like this:

- create which sets FreeOnTerminate and starts the thread
- execute which sets up a TWSocket as TCP-Server with
  multithreaded:=true
- in the OnSessionAvailable of that TWSocket another one is created with
  multithreaded:=true as well and the connection is handed over (just
  reused the code which wasn't in the thread before and worked before
  packing it in the thread, but with a bad resonding GUI)
- in the execute I have a loop like this after creating the
  server socket:

  while not terminated do
  begin
GetMessage(msg, 0, 0, 0);

if msg.message = wm_mythreadquit then break;

TranslateMessage(msg);
DispatchMessage(msg);
  end;


- the thread has a overriden Terminate which
  PostThreadMessage(self.threadid, wm_mythreadquit);

Terminating the thread works well but all ICS communication
doesn't work.

Sending calls via the socket are done from outside the
thread's context and are embedded in other threads, but I
don't get a crash, so that's no problem except it simply
doesn't send...

What's wrong here?

Greetings

Markus

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


Re: [twsocket] Large amount of OnDataAvailable calls and timer/frozen main thread

2006-10-27 Thread Angus Robertson - Magenta Systems Ltd
> - if the client sends requests as a huge bulk
>   (e.g. 10.000 requests in a relatively [not completely] tight loop)
>   the statistics don't get updated for a while
> - in OnDataAvailabe check whether at least 1 sec. has been elapsed 
> and the manually call OnTimer.

I've done that, the OnTimer event sets a variable from GetTickCount each 
time it runs, and other events can check the timer event has been called 
recently and if not do so.  I have a little library of Tick timer 
related functions including checking the 49 day wrap around.  Wonder if 
64-bit Windows has a GetTickCount64?

But in your case, if OnData events are firing, OnTimer should as well?

Angus


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