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 ) ) {
res[i++] = ch_strdup( s );
}
+
+ pthread_mutex_unlock(&strtok_mutex);
+
res[i] = NULL;
free( str );
pthread_mutex_init( &active_threads_mutex, pthread_mutexattr_default );
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 );
*/
time_t currenttime;
pthread_mutex_t currenttime_mutex;
+pthread_mutex_t strtok_mutex;
int active_threads;
pthread_mutex_t active_threads_mutex;
pthread_mutex_t new_conn_mutex;
extern long ops_initiated;
extern pthread_mutex_t active_threads_mutex;
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;