I haven't written an SNMP module, someone else did it for me
It
is an option to have functions called thru SNMP. But as you figured out, if this function hangs, SNMP might block.
My programmer solved this by creating a database (first in MySQL) and the tables is filled with values by one or more background processes. The snmpd ONLY reads the database, no hanging deamon can prevent that.
Later, the performance of MySQL proved to be too low (on a VIA C7 platform) so he designed his own database engine which allows much faster access. But the principle remained the same.
An added feature of using this two-layer approach is that you can add a field to each record which allow you to block any write access. That means that in a real-time process
you can control any measurement or command values going to and from the hardware. All processes continue to run, no additional debug flags and you can test your software without the hardware connected. (The latter was my idea though and not implemented in the SNMP agent but in my own project)
I also added a field last_update_ts where each writing process has to update the time stamp. No time stamp update means the updating process crashed.
jlinkels