SNMP++/Agent++ without pthreads

janzen janzen____pixelmetrix.com
Wed May 2 06:21:03 CEST 2001


One more newbie comment...

Currently my agent code is all single-threaded, and (for a variety of
reasons) I'd like to keep it that way.  There's a comment in
agent++/include/agent++.h and snmp++/include/config.h headers which
says, "uncomment this if you do not want pthreads" -- but the next line
doesn't seem to match the comment.  I think it should look something
like this:

--------------------
// uncomment this if you do not want pthreads 
// #define USE_NO_THREADS

#ifndef USE_NO_THREADS
#ifdef WIN32

#ifndef _THREADS
#define _WIN32THREADS
#define VC_EXTRALEAN
#define _THREADS
#endif

#else

#ifndef _THREADS
#define _THREADS
#endif

#endif // WIN32
#endif // USE_NO_THREADS
--------------------

Now you can either uncomment the '#define USE_NO_THREADS' line, or
specify '-DUSE_NO_THREADS' when building.

Frank, does it make sense to include something like this in the standard
distribution?

         *  *  *

More generally, am I likely to run into serious trouble without
threads?  I'm not writing a manager which needs to communicate with
various agents; just a single agent which expects to receive a request
and to fire off the response immediately.  As far as I can tell from
brief examination of Snmpx::receive() and so on, this should work just
fine.

But, what if the agent sends an SNMPv2 Inform PDU -- where in the code
does Agent++ handle acknowledgements, retries, etc.?  Am I in danger of
blocking here?  Or will this be handled in the normal course of event
processing?

Thanks in advance for any comments/suggestions...

--
Martin Janzen
janzen at pixelmetrix.com



More information about the AGENTPP mailing list