[AGENT++] thread safety

Jochen Katz katz at agentpp.com
Fri Jul 22 22:25:32 CEST 2011


Hi,

> I am new to snmp++ library. I want to know whether async as well as
> sync get, getnext, set etc of snmp class are thread safe. That is can
> two or more threads call these functions at same time.

all yes.

> The documentation says that start_poll_thread() of snmp class, which
> is required to handle responses is not thread safe.

You have to read the complete note:

* @note start_poll_thread() itself is not thread safe.
*       The caller must make sure that only one thread
*       is calling start_poll_thread() or
*       stop_poll_thread() at any point in time.

Once you have called start_poll_thread(), the thread is running and
processing the async responses. As normal usage is to call
start_poll_thread() at application start and stop_poll_thread() right
before application exit, there is no need to make start_poll_thread()
and stop_poll_thread() functions thread safe.

Regards,
  Jochen



More information about the AGENTPP mailing list