Problem with using pthread library
"John Anderson" <[email protected]>
| Newsgroups | gmane.network.net-snmp.user |
|---|---|
| Message-ID | <C7E472C326E8440B9C8CB08EF12877B1@BoardnDude> |
I ran across a problem trying to add my MIBS where net-snmp would hang. I am cross compiling net-snmp to run on a custom embedded linux application. I perform a configure where I add my mib handler files but I also add --with_ldflag=$LDFLAGS, where LDFLAGS=-lpthread. This took me lots of debugging with DEBUGMSGTL statements and I'm using net-snmp-5.4.1..tar.gz for reference. I found that the configure recognizes the fact that I want it linked with -lpthread and proceeds to add to include/net-snmp/net-snmp-config.h the following... #define NET_REENTRANT 1 and #define HAVE_PTHREAD_H 1 Well, this causes a problem where net-snmp is trying to acquire a resource lock using pthread mutexes when it has already acquired a resource lock. So the second attempt to acquire the lock hangs net-snmp. This has nothing to do with the code I added. If you just try add the link to pthread in the configure the problem occurs. The freeze occurs the first time I send an SNMP ping to my embedded system. I'm curious as to if anyone has heard of this problem? I don't need net-snmp to be reentrant. I just have a small bit of code that runs a thread to communicate with another app that sends/recvs the parameters. I could redesign it to not use threads but the code has already been used a tested so I would rather keep it as is. My solution was to edit net-snmp-config.h after running configure and undoing those defines. John Anderson ------------------------------------------------------------------------- This SF.Net email is sponsored by the Moblin Your Move Developer's challenge Build the coolest Linux based applications with Moblin SDK & win great prizes Grand prize is a trip for two to an Open Source event anywhere in the world http://moblin-contest.org/redirect.php?banner_id=100&url=/ _______________________________________________ Net-snmp-users mailing list [email protected] Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users