阅读背景:

使用pthread_setspecific和pthread_getspecific存储指向std :: map实例的指针

来源:互联网 

I'm using a map as a thread specific cache to keep track of failed LDAP searches. I dynamically allocate the map and store the pointer using pthread_setspecific. When checking the cache or incrementing the failure count I use pthred_getspecific in order to retrieve the void* pointer and static_cast the pointer back to my map type. Calls to the map using the [] operator don't appear to affect the state of the map and calls to map->size() always return 0. It feels like I'm probably incorrectly using pthread_getspecific but from the examples I've looked at my code looks right.I'm using a map as a thread specific cache to k




你的当前访问异常,请进行认证后继续阅读剩余内容。

分享到: