#include <vppinfra/format.h>
#include <vppinfra/hash.h>
#include <vppinfra/math.h>
+#include <vppinfra/lock.h>
static inline void
elog_lock (elog_main_t * em)
{
if (PREDICT_FALSE (em->lock != 0))
while (clib_atomic_test_and_set (em->lock))
- ;
+ CLIB_PAUSE ();
}
static inline void
{
if (PREDICT_FALSE (em->lock != 0))
{
- CLIB_MEMORY_BARRIER ();
- *em->lock = 0;
+ clib_atomic_release (em->lock);
}
}
em->string_table_tmp = va_format (em->string_table_tmp, fmt, &va);
va_end (va);
+ /* String table entries MUST be NULL terminated */
+ len = vec_len (em->string_table_tmp);
+ ASSERT (len > 0);
+ if (em->string_table_tmp[len - 1] != 0)
+ vec_add1 (em->string_table_tmp, 0);
+
/* See if we already have this string in the string table */
p = hash_get_mem (em->string_table_hash, em->string_table_tmp);
return (p[0]);
}
- /* We don't, so add it. String table entries MUST be NULL terminated */
- len = vec_len (em->string_table_tmp);
- ASSERT (len > 0);
- if (em->string_table_tmp[len - 1] != 0)
- vec_add1 (em->string_table_tmp, 0);
+ /* We don't, so add it. */
offset = vec_len (em->string_table);
vec_append (em->string_table, em->string_table_tmp);