Re: activate the eventloop

On Tue, 12 Sep 2000, Derruau, Mathias wrote:

> Date: Tue, 12 Sep 2000 18:13:21 +0100
> From: "Derruau, Mathias" <Mathias_Derruau@hplb.hpl.hp.com>
> To: "'www-lib@w3.org'" <www-lib@w3.org>
> Subject: activate the eventloop
> Resent-Date: Tue, 12 Sep 2000 13:13:43 -0400 (EDT)
> Resent-From: www-lib@w3.org
> 
> Hi,
> 
> I am using libwww to fetch files using ftp and http.
> For the purpose of my application, I need to use the eventloop of libwww in
> a thread.
> The eventloop can be considered as a kind of daemon that needs to be woken
> up by one of the other threads.
> 
> But once the daemon is in the eventloop, I have not been able to interact in
> any manner with it.
> The eventloop sample application with the console_parser doesn't seem to
> work on NT (I tried to replace STDIN_FILENO by _fileno(stdin)), and my
> problem is even slightly different, as I want to signal the daemon to do a
> request more than having a console.
> 
> Does anyone have an idea of what possible ways there are to implement this?

I did something like this using a local UNIX socket as an additional input
source to the eventloop, one thread writes to that socket, the event-loop
thread reads from it.

I do not know if this can work on NT (it'll probably work using a local 
TCP socket, but....).


The key call to this is something like:

    HTEvent_register(sock, HTEvent_READ, ev);

with an event ev, that defines a callback to your application. In that
callback you can do whatever you want...

However, I have to admit it, I dumped libwww and I am in the process of
writing a tailored C++ library for handling HTTP and FTP traffic, after I
had to tackle so many problems in such a complicated piece of
software.

> Any comment appreciated
> Thanks


peter

Received on Tuesday, 12 September 2000 13:45:15 UTC