W3C home > Mailing lists > Public > www-lib@w3.org > July to September 2000

Re: activate the eventloop

From: Jens Meggers <jens.meggers@firepad.com>
Date: Wed, 20 Sep 2000 09:20:35 -0700
Message-ID: <DDF913B74F07D411B22500B0D0206D9F0D74A5@FIREPLUG>
To: "'www-lib@w3.org'" <www-lib@w3.org>
Mathias,

your event loop thread is stucked in the GetMessage() operation. It
waits for messages in the threads event queue and dispatches them. Thus,
you cannot receive UDP packet.
I propose to use (windows) messages instead of UDP sockets. Doing this,
GetMessage() will dispatch as well your own messages. In addition,
messages are safer because a UDP packet may get lost even on a local
machine. I know that this will never happen, but from the specification
it may be done.
Make a copy of the eventloop in HTEvtLst and replace it by something
similar like this:


	while (true) {

		int res = GetMessage(&message, NULL,0,0);

		if (res > 0) {

		  // handler for a HTTP request 

		  if (message.message == WM_WWW_REQUEST ) {

			// enter some code here to start the request
			// (you have to define and use WM_WWW_REQUEST)

		  } else {

			// dispatch lib WWW event
		    TranslateMessage(&message);
		    DispatchMessage(&message);

		  }

		} else {

			printf("message error\n");

		}

	}


I hope that helps,

Jens


-----Original Message-----
From: Derruau, Mathias [mailto:Mathias_Derruau@hplb.hpl.hp.com]
Sent: Wednesday, September 20, 2000 3:07 AM
To: 'www-lib@w3.org'
Subject: Re: activate the eventloop


Thank you for the tip,

I now have one thread sending messages to the eventloop thread through a
UDP
socket.
It works fine for the first message passed, the callback is activated,
as
well as the request terminator, but if my main thread wants to pass a
second
message, it doesn't seem to be caught by the eventloop thread.
What do I have to do to make the eventloop thread listen again on the
socket
(tried to register the event again in the callback function, but it
results
in an infinite loop)?

Thanks for help

Mathias Derruau

PS: when i set the mode to non-preemptive, the chunk resulting in a
request
is not complete. Anyone any idea about this?
Received on Wednesday, 20 September 2000 12:26:23 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Monday, 23 April 2007 18:18:38 GMT