int online_cpus(void)
{
+#ifdef NO_PTHREADS
+ return 1;
+#else
#ifdef _SC_NPROCESSORS_ONLN
long ncpus;
#endif
#endif
return 1;
+#endif
}
int init_recursive_mutex(pthread_mutex_t *m)
{
+#ifndef NO_PTHREADS
pthread_mutexattr_t a;
int ret;
pthread_mutexattr_destroy(&a);
}
return ret;
+#else
+ return 0;
+#endif
+}
+
+#ifdef NO_PTHREADS
+int dummy_pthread_create(pthread_t *pthread, const void *attr,
+ void *(*fn)(void *), void *data)
+{
+ /*
+ * Do nothing.
+ *
+ * The main purpose of this function is to break compiler's
+ * flow analysis and avoid -Wunused-variable false warnings.
+ */
+ return ENOSYS;
+}
+
+int dummy_pthread_init(void *data)
+{
+ /*
+ * Do nothing.
+ *
+ * The main purpose of this function is to break compiler's
+ * flow analysis or it may realize that functions like
+ * pthread_mutex_init() is no-op, which means the (static)
+ * variable is not used/initialized at all and trigger
+ * -Wunused-variable
+ */
+ return ENOSYS;
}
+
+int dummy_pthread_join(pthread_t pthread, void **retval)
+{
+ /*
+ * Do nothing.
+ *
+ * The main purpose of this function is to break compiler's
+ * flow analysis and avoid -Wunused-variable false warnings.
+ */
+ return ENOSYS;
+}
+
+#endif