<snip entire post> > > Is there a way to share handles between threads? When I try it I get the > error > "handle 2 is owned by thread 854eee8 (handles can't be shared between > threads and your driver may need a CLONE method added)" > > I need it to be one object handle because I have multiple threads that all > need to use one outgoing socket connection.
>>> Wiebren - there a couple of different ways to manage this. You should, however, first figure out where the "CLONE method" error is originating. I've seen that when attempting multi-threaded applications with older version of the DBI package. If all communication will go through a single socket, then you can either: 1) First create the socket handle and as you spawn new threads you can pass the handle along (eg. $thr = threads->create(\&subroutine, $socket_handle); # use references to socket handle as desired 2) Probably the cleanest approach is to have all your threads open up sockets (as needed) to connect to the single "outgoing" socket. This way there is no sharing of resources. I hope this helps! Steve
