if (!value) { \
static const NAME##_type initial_value = __VA_ARGS__; \
\
- value = xmalloc(sizeof *value); \
+ value = malloc(sizeof *value); \
+ if (value == NULL) { \
+ out_of_memory(); \
+ } \
*value = initial_value; \
xpthread_setspecific(NAME##_key, value); \
} \
if (!value) { \
static const NAME##_type initial_value = __VA_ARGS__; \
\
- value = xmalloc(sizeof *value); \
+ value = malloc(sizeof *value); \
+ if (value == NULL) { \
+ out_of_memory(); \
+ } \
*value = initial_value; \
xpthread_setspecific(NAME##_key, value); \
} \
OVS_TRY_LOCK(false, once->mutex);
static inline bool
-ovsthread_once_is_done__(const struct ovsthread_once *once)
+ovsthread_once_is_done__(struct ovsthread_once *once)
{
bool done;
void forbid_forking(const char *reason);
bool may_fork(void);
+\f
+/* Useful functions related to threading. */
+
+int count_cpu_cores(void);
#endif /* ovs-thread.h */