Multithreading libwww

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Multithreading libwww

Annesley Newholm

Hi,

 

I’m new to libwww. I’m trying to write a multi-threaded robot using libwww. I have used the –enable-reentrant option in the compile but I think the event loop is in some way global and causing the system to crash. Placing the event loop in a mutex solves this but makes the multi-threading pointless. There is some discussion on libwww and multi-threading but I can’t find any helpful conclusions…

 

Is there a way to make the event loop multi-threaded?

Would it be better instead to kick off the robots as processes instead of threads?

If I understand correctly I can use non-blocking sockets and pipelining to hold multiple conversations through sockets from many threads. Is what I’m trying to do conceptually possible (i.e. shall I write the socks communication myself)?

 

Annesley

Reply | Threaded
Open this post in threaded view
|

Re: Multithreading libwww

Vic Bancroft-2

Annesley Newholm wrote:

>I'm new to libwww. I'm trying to write a multi-threaded robot using libwww.
>I have used the -enable-reentrant option in the compile but I think the
>event loop is in some way global and causing the system to crash.
>
Yes, it would certainly take more than a compile switch to make the code
reentrant.

>Would it be better instead to kick off the robots as processes instead of
>threads?
>  
>
Yes, a multiprocess model might be more natural.

>If I understand correctly I can use non-blocking sockets and pipelining to
>hold multiple conversations through sockets from many threads.
>
It is possible, since the library can support multiple concurrent
requests and will make the appropriate function callbacks.  I have used
the library in a multithreaded context and found a queueing approach
most helpful.

more,
l8r,
v


>Is what I'm
>trying to do conceptually possible (i.e. shall I write the socks
>communication myself)?
>
>
>
>Annesley
>
>
>  
>


--
"The future is here. It's just not evenly distributed yet."
 -- William Gibson, quoted by Whitfield Diffie