[AGENT++] Consts in SNMP++

Marek Malowidzki malowidz at wil.waw.pl
Thu Feb 12 09:49:52 CET 2004


> Hi,
>
> the const fixes will be in the next release.

Great.

> > Since friendly_name() seems not be called by SNMP++/AGENT++
> > internally, it would be sufficient if the user of an address object
> > synchronize access to this method when the address object is used in
> > multiple threads. On the other hand, it would also be no problem to
> > make the method synchronized in SNMP++.
> >
> > Let's see what Jochen decides ;-)
>
> :-) I would decide that the Address classes are not to be used between
> multiple threads. The same is true for Pdu, Vb, OctetStr,...

Well, my SNMP++.NET classes only enable the creation of immutable objects.
That is, once you have created, e.g., a Vb, you cannot change it. Dot. Pdu
is an exception and must be manually synchronized by a user (since there are
too many things that may be changed like communities, engine id, etc.).

> If you're only worried about the friendly_name method, I would suggest
> calling it once after creation of an address object. Or I could change any
> iv_friendly_name[0] = 0 to memset(iv_friendly_name,...).

Yes, indeed, calling it immediately would help. However... what happens if
DNS is not working correctly? You may end up with a long delay on Address
creation (which may be not desirable) or, even worse, a repeated call to
friendly_name() could repeat the discrovery - and the problem returns.

Indeed, memset would be a simple solution (or the earlier mentioned careful
copying).

Marek




More information about the AGENTPP mailing list