First of all, please post a new message, instead of replying to the digest and quoting the entire (unrelated!) digest.
On Wed, 17 Nov 2004 18:30:04 +1100 Russell wrote: RB> The subagent process is multi-threaded. Raising a trap works fine if I do RB> it in the main thread [...] RB> But, if I call send_v2trap() from another thread I get intermittent RB> core-dumps, not surprising perhaps as netsnmp doesn't claim to be RB> thread-safe. Using threads in the agent is *completely* unsupported. RB> - Figuring out how to use netsnmp in a thread-safe manner, so I can call RB> send_v2trap() from other threads. The reason it is unsupported is that nobody has documented the gotchas and provided workarounds or a patch to fix or provide new APIs. If you have time for that, that'd be great! RB> But so far I haven't made much headway understanding README.thread. README.thread details using threads with client applications. RB> - Or, queue the trap requests and send them from the main thread. This RB> would be fine except agent_check_and_process(true) times out after 15 RB> seconds, too much latency for this application. I'm tempted to leave you hanging, in the hopes that you go off and figure out to use threads in the agent, but I won't. There is a much easier way to do what you are trying to do. All you need is a file descriptor to communicate between the thread and the master agent. It can be a unix domain socket, a normal socket or a pipe. Then you register a function to be called when data arrives on the socket. The thread sends data to the pipe, which should wake up the main thread to process it. A simple example can be found here: http://www.net-snmp.org/faqs/rstory/#readfds RB> Alternatively, is there a RB> straightforward way to make calls to send_v2trap() thread-safe ? If there was, we would have already done it! -- Robert Story; NET-SNMP Junkie Support: <http://www.net-snmp.org/> <irc://irc.freenode.net/#net-snmp> Archive: <http://sourceforge.net/mailarchive/forum.php?forum=net-snmp-users> You are lost in a twisty maze of little standards, all different. ------------------------------------------------------- This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS DOWNLOAD - A multidimensional database that combines robust object and relational technologies, making it a perfect match for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8 _______________________________________________ Net-snmp-users mailing list [EMAIL PROTECTED] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users