在多线程程序中调用ldap_initialize总是莫名其妙的出现
- [New Thread 0x9f1feb90 (LWP 1733)]
- [New Thread 0x9fbffb90 (LWP 1715)]
- [New Thread 0xa0600b90 (LWP 1714)]
- [New Thread 0xa1001b90 (LWP 1713)]
- [New Thread 0xa1a02b90 (LWP 1712)]
- [New Thread 0xa2403b90 (LWP 1711)]
- [New Thread 0xa2e04b90 (LWP 1710)]
- [New Thread 0xa3805b90 (LWP 1709)]
- [New Thread 0xa4206b90 (LWP 1708)]
最后发现原来ldap_initialize不支持多线程的调用,解决方法可以在主线程调用ldap_set_option首先将全局变量初始化,然后子线程调用ldap_initialize就可以了,如下:
- int ldap_debug = -1;
- ldap_set_option(NULL, LDAP_OPT_DEBUG_LEVEL, &ldap_debug);
阅读(1141) | 评论(0) | 转发(0) |