I agree to your point that we need to take lock on every place of my mib module (whose code is generated by mib2c) which access the CONTAINER (*_set_reserve1() , *_set_reserve2()....., *_set_free(), *_set_undo(),*_get_value()...) But could u just let me know that do in any case locking to be done in netsnmp code and api's.
Br Gaurav ----- Original Message ----- From: Dave Shield <[EMAIL PROTECTED]> To: [EMAIL PROTECTED] Cc: [email protected] Sent: Mon, 30 Jun 2008 13:38:44 +0530 (IST) Subject: Re: Multithreaded : IS IT Safe to create new thread for updating CONTAINERS 2008/6/30 <[EMAIL PROTECTED]>: > ..... But i am not sure where all to use mutexs. > I am using mutexes in following places : > updateCurrentAlarmTable_MyOwnMethod() > initialize_table_currentAlarmTable() > > Do i also need to take lock on following methods provided by netsnmp > currentAlarmTable_set_reserve1() > currentAlarmTable_set_reserve2() > currentAlarmTable_set_action() > currentAlarmTable_set_commit() > currentAlarmTable_set_free() > currentAlarmTable_set_undo() > currentAlarmTable_get_value() > as they also access CONTAINER Bear in mind that I am not an expert in multi-threaded programming. But I would expect that you would need a mutex lock around *every* bit of code that works with row data obtained from the table container, That's the code in your MIB module *and* any similar code within the relevant handler routines. I am not familiar with the module framework you are using, but I would expect that most of the places you mention would indeed need to be protected. The question to bear in mind throughout is: "would it matter if updateCurrentAlarmTable_MyOwnMethod() cleared all the rows from the table at this precise moment?" If the table being emptied would break a given section of code, then that code needs to be protected. Or at least, that's my understanding. Someone who actually knows about such things might be able to advise you differently. Dave ------------------------------------------------------------------------- Check out the new SourceForge.net Marketplace. It's the best place to buy or sell services for just about anything Open Source. http://sourceforge.net/services/buy/index.php _______________________________________________ Net-snmp-coders mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/net-snmp-coders
