Re: threads and pipelining

Hello,

In our previous episode, Mihut Ionescu said:
> 
> I would like to build a multithreaded proxy using libwww.  Each thread
> would handle a different connection, where true pipelined requests can be
> serviced (multiple requests can be received over this connection before
> any response is sent back).

Maybe the question is "is libwww multi-thread safe?".

My answer is that I don't think it's 100 %safe. There are some places
with global static variables, the authentication trees are not semaphore 
protected, and so on.

Other people have been trying to make it multi-thread safe, but I don't
know what's the state of their work.

  Each thread would do more work than just
> fetching an URL, so I don't believe that the "pseudothreads" offered by
> libwww would be enough.  From what I have read, libwww can only handle
> multiple open connections, multiplexed using "select" (I assume), and I'm
> not really sure where the additional code that needs to be executed in
> each thread would go.
> 

Your assumption is correct regarding select.

Any extra code would need to be done thru a handler. You can register
handlers that can be called at different places/states by libwww. 

> Is this doable using libwww?  Thank you for you help.

I think that using multiple threads will not be very easy as you'd need to
patch other parts of the code or write workarounds in your handlers.

-Jose

Received on Friday, 1 September 2000 05:40:41 UTC