31 # include <linux/types.h> 33 enum { ST_MAX_THREAD_NAME_LEN = 64 };
39 int (*func)(
void *),
void *
args,
40 const char *name_fmt, ...)
43 char name_str[ST_MAX_THREAD_NAME_LEN];
48 va_start(vl, name_fmt);
49 rc = vsnprintf(name_str,
sizeof(name_str), name_fmt, vl);
54 th = kthread_create(func,
args,
"%s", name_str);
68 return kthread_stop(th);
84 set_current_state(TASK_INTERRUPTIBLE);
85 while (!kthread_should_stop()) {
87 set_current_state(TASK_INTERRUPTIBLE);
89 set_current_state(TASK_RUNNING);
102 void* (*func)(
void *),
void *
args, ...)
128 if (pthread_join(*th, &result) == 0) {
129 rc = *((
int *)result);
158 int *nr_failed_assertions;
166 memset(mthread, 0,
sizeof(
struct m0_thread));
175 nr_failed_assertions =
m0_alloc(
sizeof *nr_failed_assertions);
176 if (nr_failed_assertions ==
NULL)
206 if (nr_rounds-- == 0 ||
time_now() > end)
218 return nr_failed_assertions;
220 k_sys_return = *nr_failed_assertions;
244 for (
i = 0;
i < nr_workers;
i++) {
269 for (
i = 0;
i < nr_workers;
i++) {
static int thread_join(st_thread_t *th)
static m0_bindex_t indices[ZEROVEC_UT_SEGS_NR]
static int thread_init(st_thread_t **ret_th, void *(*func)(void *), void *args,...)
static void thread_fini(st_thread_t *th)
int st_stop_workers(void)
#define MEM_ALLOC_PTR(arr)
int st_run(const char *test_list_str)
M0_INTERNAL int m0_thread_adopt(struct m0_thread *thread, struct m0 *instance)
int st_set_worker_tid(int idx, pid_t tid)
int st_get_nr_workers(void)
struct m0 * st_get_motr(void)
void * m0_alloc(size_t size)
static void mem_free(const struct m0_be_btree *btree, struct m0_be_tx *tx, void *ptr)
M0_INTERNAL void m0_thread_shun(void)
#define MEM_ALLOC_ARR(arr, nr)
static void * mem_alloc(const struct m0_be_btree *btree, struct m0_be_tx *tx, m0_bcount_t size, uint64_t zonemask)
#define M0_CLIENT_THREAD_ENTER
static int start(struct m0_fom *fom)
const char * st_get_tests()
static void * st_worker(void *in)
struct st_cfg st_get_cfg()
int st_start_workers(void)
static st_thread_t ** workers