lextudio / sharpsnmplib

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

Question about thread-safety of the Manger class #517

Closed lextudio-support closed 2 hours ago

lextudio-support commented 2 hours ago

Hi !

In the absence of async methods like "BeginGet()" ... I would have to use a huge number of threads to process snmp requests to many devices.

Is the Manager class thread-safe?? I'll create one Manager class and pass a reference to each running thread, each one processing a "Manager.Get(..)" [this means:All do it on the same instance]. Is this secure?

How many resources does a Manager class consume, or, which overhead would I create, if I have to use, say thousend, Manager instances??

Can we expect to get async methods [one day ;-) ] ??

I found this project on my yearly search about snmp libs for .Net ;-)

Basically - and my tests were all successfully - this looks really like good work!!!

br--mabra

Original Reported Date: 2008-12-16T12:57:28.947-08:00 Original CodePlex Discussion Thread ID: 42448

lextudio-support commented 2 hours ago

Copied from CodePlex without authors:

Well, first I plan to provide asynchronous methods after releasing #SNMP 1.5. So you needn't wait another year.

Second, at this moment Manager is not thread safe. I need time to ensure thread safety, so it cannot be part of 1.5. Don't try to use one instance for several threads until I get every methods thread safe.

Third, you needn't create a Manager instance for each thread. Simply call the static methods of Manager which should be thread-safe after adding lock (the latest Change Set).

Please visit this site frequently or subscribe to my blog at http://lextm.blogspot.com for latest news. Your comments and advice is always welcome.

-Lex

Original Posted Date: 2008-12-19T02:30:34.99-08:00

lextudio-support commented 2 hours ago

Copied from CodePlex without authors:

Hi !

Good answer! Many thanks! For my first experiments, this is ok. For larger work - not planned yet - waiting for
the Begin{Any}(..) methods is not a problem. Very exciting, that you plan this!

br--mabra

Original Posted Date: 2008-12-19T11:44:35-08:00

lextudio-support commented 2 hours ago

Marked as Answer Date: 2013-10-06T21:08:35.597-07:00