Re: scotty and multi-threading

Juergen Schoenwaelder (schoenw@cs.utwente.nl)
Thu, 13 Mar 1997 23:07:40 +0100

clau@plaintree.com said:

clau> Has anyone tried using scotty in a multithreaded program
clau> on Windows? Here is what I'm trying to do under Windows
clau> without much luck:
clau>
clau> - I have a Win32 application that spawn off new threads
clau> whenever there are chuncks of SNMP operations to do.
clau> Each new thread would create its own interpreter by
clau> calling Tcl_CreateInterp() and Tcl_Init().
clau>
clau> - The loading of the Tnm DLL is done only once in TCL's
clau> init.tcl. I put the following two lines in TCL's
clau> init.tcl:
clau>
clau> package require Tnm
clau> snmp session # so that all the mibs get loaded up front
clau>
clau> - So far so good. I can spawn off a new thread and make
clau> snmp request. But as soon as two threads try to make
clau> snmp request at the same time (each thread is in its own
clau> interpreter and and using its own snmp session), one of
clau> them dies. The other one would finish but then I
clau> couldn't make any more snmp request in any thread.
clau>
clau> I believe there must be some global variables in that the
clau> snmp request is relying on. Any pointers will be greatly
clau> appreciated.

Yes, the Tnm extension is currently not thread-safe. Examples for
global data structures are the internal SNMP session list or the
internal SNMP request list. I have no idea how many code changes are
required to make these lists private properties of every interpreter.
There might be other global data structures as well.
Juergen

-- 
Juergen Schoenwaelder schoenw@cs.utwente.nl http://www.cs.utwente.nl/~schoenw
Computer Science Department, University of Twente,   (Fax: +31-53-489-3247)
P.O. Box 217, NL-7500 AE Enschede, The Netherlands.  (Tel. +31-53-489-3678)
--
!! This message is brought to you via the `tkined & scotty' mailing list.
!! Please do not reply to this message to unsubscribe. To subscribe or
!! unsubscribe, send a mail message to <tkined-request@ibr.cs.tu-bs.de>.
!! See http://wwwsnmp.cs.utwente.nl/~schoenw/scotty/ for more information.