lextudio / sharpsnmplib

Sharp SNMP Library- Open Source SNMP for .NET
https://sharpsnmp.com
MIT License
356 stars 152 forks source link

Multi-Threading with ISnmpMessage classes #505

Closed lextudio-support closed 3 hours ago

lextudio-support commented 3 hours ago

Hi Lex,

You wrote in FAQs that the library is not thread safe

Is this library thread safe? : Not yet. Please use static methods in Messenger class which should be thread safe.

However in one of the older posts

https://sharpsnmplib.codeplex.com/discussions/234718

You said that ISnmpMessage classes can be used in multi-threaded environment if they are spawned and thrown away for each request. Has this changed over the past 3 years? Meaning that is it still safe to use Level-1 ISnmpMessage derived classes in a multi-threaded fashion without locking if they get spawned and thrown away each time?

Original Reported Date: 2013-05-12T15:03:27.63-07:00 Original CodePlex Discussion Thread ID: 443402

lextudio-support commented 3 hours ago

Copied from CodePlex without authors:

ISnmpMessage derived classes can be viewed as the object representation of raw bytes in the packets,

And that's why I stated they can use in multi-threaded environment. Since static methods in Messenger class generate such instances under the hood, I think they are thread-safe too.

Regards,

Lex

Original Posted Date: 2013-05-13T21:21:55.077-07:00

lextudio-support commented 3 hours ago

Marked as Answer Date: 2013-10-06T20:18:17.43-07:00