#include <unistd.h>
#include <netdb.h>
#include <pthread.h>
+#include <immintrin.h>
+#include <stdbool.h>
#include <RIC_message_types.h> // needed for route manager messages
must be at the start of a word (i.e. must be immediatly preceeded by whitespace).
*/
static char* clip( char* buf ) {
- char* tok;
+ char* tok=NULL;
while( *buf && isspace( *buf ) ) { // skip leading whitespace
buf++;
}
}
- for( tok = buf + (strlen( buf ) - 1); tok > buf && isspace( *tok ); tok-- ); // trim trailing spaces too
+ for( tok = buf + (strlen( buf ) - 1); tok > buf && isspace_with_fence( *tok ); tok-- ); // trim trailing spaces too
*(tok+1) = 0;
return buf;
int grp; // group number
rtable_ent_t const* rte; // route table entry added
char* tokens[128];
- char* tok; // pointer into a token or string
+ char* tok=NULL; // pointer into a token or string
char wbuf[1024];
if( ! buf ) {
while( *buf && isspace( *buf ) ) { // skip leading whitespace
buf++;
}
- for( tok = buf + (strlen( buf ) - 1); tok > buf && isspace( *tok ); tok-- ); // trim trailing spaces too
+ for( tok = buf + (strlen( buf ) - 1); tok > buf && isspace_with_fence( *tok ); tok-- ); // trim trailing spaces too
*(tok+1) = 0;
memset( tokens, 0, sizeof( tokens ) );
rt = NULL;
}
+ pthread_mutex_destroy(ctx->rtgate);
rt = uta_rt_clone( ctx, ctx->rtable, rt, all ); // also sets the ephash pointer
if( rt != NULL ) { // very small chance for nil, but not zero, so test
rt->ref_count = 0; // take no chances; ensure it's 0!
}
pthread_mutex_unlock( ctx->rtgate );
}
+
+int isspace_with_fence(int c) {
+ _mm_lfence();
+ return isspace( c );
+}
+
#endif