Robert> The first step I would recommend would be to simply separate packet Robert> reception from packet processing. On thread would simply receive Robert> packets and put them in a queue for the second thread to process them.
Hermann> So I would think of handle_snmp_packet(). There is one thread Hermann> (the "main" thread) enqueuing the PDUs as you said in this function. Hermann> And signalling the worker threads that there are new requests. Hold on - Robert suggested just *two* threads - one to receive the requests and *one* to process them. A single worker thread - not multiple threads. That means there's a single point where concurrency needs to be handled - the queueing/dequeueing of requests on this "to-be-processed" list. As soon as you move to multiple worker threads, you start having to think about interactions between different handlers and concurrency between them. That's obviously a sensible goal in the long run, but I'd suggest you tackle this one step at a time. Robert> Once that works, I would look into moving packet decoding into the Robert> reception thread. I don't think it would warrant it's own thread, Robert> as I expect that the decoding of packets to be fairly quick. Actually, I'd be inclined to start with the first-stage threading coming *after* the packet has been decoded. As you say, that's relatively quick and it's the later processing that tends to be the bottleneck. So the concurrency handling could be dealt with by the 'handle_snmp_packet' routine, rather than having to delve into the innards of the library. That feels a much safer approach than trying to make the whole library inherently multi-threaded. Dave ------------------------------------------------------- This SF.net email is sponsored by: IT Product Guide on ITManagersJournal Use IT products in your business? Tell us what you think of them. Give us Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more http://productguide.itmanagersjournal.com/guidepromo.tmpl _______________________________________________ Net-snmp-coders mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
