27 #include <linux/limits.h> 29 #define M0_TRACE_SUBSYSTEM M0_TRACE_SUBSYS_MEMORY 116 M0_PRE(!pthread_equal(
q->t_h.h_id, pthread_self()));
118 result = -pthread_join(
q->t_h.h_id,
NULL);
126 return -pthread_kill(
q->t_h.h_id, sig);
133 size_t nr_bits =
min64u(processors->
b_nr, CPU_SETSIZE);
138 for (idx = 0; idx < nr_bits; ++idx) {
140 CPU_SET(idx, &cpuset);
143 return -pthread_setaffinity_np(
q->t_h.h_id,
sizeof cpuset, &cpuset);
160 PTHREAD_CREATE_JOINABLE);
170 static char pidbuf[20];
176 env_ptr = getenv(
"M0_DEBUGGER");
184 (void)snprintf(pidbuf,
ARRAY_SIZE(pidbuf),
"%i", getpid());
250 #undef M0_TRACE_SUBSYSTEM M0_INTERNAL void m0_enter_awkward(void)
M0_INTERNAL uint64_t m0_process(void)
M0_INTERNAL char m0_argv0[PATH_MAX]
M0_INTERNAL int m0_thread_init_impl(struct m0_thread *q, const char *name)
M0_INTERNAL char * m0_debugger_args[4]
static struct m0_semaphore q
M0_INTERNAL int m0_thread_confine(struct m0_thread *q, const struct m0_bitmap *processors)
int m0_thread_join(struct m0_thread *q)
M0_INTERNAL void m0_threads_fini(void)
M0_INTERNAL void m0_set(struct m0 *instance)
struct m0 * tls_m0_instance
struct m0_thread_tls t_tls
static pthread_attr_t pthread_attr_default
M0_INTERNAL struct m0_thread_tls * m0_thread_tls(void)
struct m0_thread_arch_tls tls_arch
#define M0_ERR_INFO(rc, fmt,...)
M0_INTERNAL void m0_addb2_global_thread_leave(void)
static void * uthread_trampoline(void *arg)
M0_INTERNAL int m0_thread_signal(struct m0_thread *q, int sig)
M0_INTERNAL void * m0_thread_trampoline(void *arg)
static struct m0_thread main_thread
static struct m0_thread t[8]
M0_INTERNAL void m0_addb2_global_thread_enter(void)
M0_INTERNAL void m0_threads_once_fini(void)
M0_INTERNAL bool m0_is_awkward(void)
static __thread struct m0_thread_tls * tls
static uint64_t min64u(uint64_t a, uint64_t b)
static __thread struct m0_thread thread
M0_INTERNAL bool m0_bitmap_get(const struct m0_bitmap *map, size_t idx)
M0_INTERNAL int m0_threads_once_init(void)
static struct m0 instance
struct m0_thread * tls_self
M0_INTERNAL void m0_exit_awkward(void)
M0_INTERNAL uint64_t m0_pid(void)
char t_namebuf[M0_THREAD_NAME_LEN]
M0_INTERNAL int m0_threads_init(struct m0 *instance)
M0_INTERNAL int m0_thread_arch_adopt(struct m0_thread *thread, struct m0 *instance, bool full)
M0_INTERNAL void m0_thread_arch_shun(void)
enum m0_thread_state t_state