{
char **res;
char *s;
+ char *lasts;
int i;
/* protect the input string from strtok */
res = (char **) ch_malloc( (i + 1) * sizeof(char *) );
i = 0;
- pthread_mutex_lock(&strtok_mutex);
-
- for ( s = strtok( str, brkstr ); s != NULL; s = strtok( NULL,
- brkstr ) ) {
+ for ( s = strtok_r( str, brkstr, &lasts );
+ s != NULL;
+ s = strtok_r( NULL, brkstr, &lasts ) )
+ {
res[i++] = ch_strdup( s );
}
- pthread_mutex_unlock(&strtok_mutex);
-
res[i] = NULL;
free( str );
#ifdef SLAPD_CRYPT
pthread_mutex_t crypt_mutex;
#endif
-pthread_mutex_t strtok_mutex;
int num_conns;
long ops_initiated;
pthread_mutex_init( &new_conn_mutex, pthread_mutexattr_default );
pthread_mutex_init( ¤ttime_mutex, pthread_mutexattr_default );
- pthread_mutex_init( &strtok_mutex, pthread_mutexattr_default );
pthread_mutex_init( &entry2str_mutex, pthread_mutexattr_default );
pthread_mutex_init( &replog_mutex, pthread_mutexattr_default );
pthread_mutex_init( &ops_mutex, pthread_mutexattr_default );
extern pthread_cond_t active_threads_cond;
extern pthread_mutex_t currenttime_mutex;
-extern pthread_mutex_t strtok_mutex;
extern pthread_mutex_t entry2str_mutex;
extern pthread_mutex_t new_conn_mutex;
extern pthread_mutex_t num_sent_mutex;
/* generate a word-based centroid */
} else {
- for ( w = strtok( val[j], WORD_BREAKS ); w != NULL;
- w = strtok( NULL, WORD_BREAKS ) ) {
+ char *lasts;
+ for ( w = strtok_r( val[j], WORD_BREAKS, &lasts );
+ w != NULL;
+ w = strtok_r( NULL, WORD_BREAKS, &lasts ) ) {
key.dptr = w;
key.dsize = strlen( key.dptr ) + 1;
(void) ldbm_store( ldbm[i], key, data, LDBM_INSERT );