Motr  M0
thread.c File Reference
#include "lib/misc.h"
#include "ut/ut.h"
#include "lib/ub.h"
#include "lib/thread.h"
#include "lib/bitmap.h"
#include "lib/assert.h"
#include "lib/memory.h"
#include "lib/semaphore.h"
#include "module/instance.h"
#include <pthread.h>
Include dependency graph for thread.c:

Go to the source code of this file.

Enumerations

enum  { NR = 255 }
 
enum  { UB_ITER = 10000 }
 

Functions

void test_is_awkward (void)
 
static void test_adopt (void)
 
static void t0 (int x)
 
static void t2 (int n)
 
static void t3 (int n)
 
static void forty_two_func (const char *s)
 
static int lambda42_init (int x)
 
static void lambda42_func (int x)
 
static int lambda_42_init (int x)
 
static void lambda_42_func (int x)
 
void test_thread (void)
 
static void threads_set0 (void)
 
static int ub_init (const char *opts M0_UNUSED)
 
static void ub_fini (void)
 
static void ub0 (int x)
 
static void ub_spawn (int i)
 
static void ub_join (int i)
 
static int ub_spawn_initcall (int x)
 
static void ub_spawn_init (int i)
 
static void ub_join_all (void)
 
static void set_and_check_is_awkward (void)
 
static void ut_t0_handler1 (int arg)
 
static void * adopted (void *arg)
 

Variables

static int t0place
 
static struct m0_thread t [NR]
 
static int r [NR]
 
static char t1place [100]
 
static struct m0_thread ubt [UB_ITER]
 
struct m0_ub_set m0_thread_ub
 
static struct m0_semaphore synch
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum
Enumerator
NR 

Definition at line 33 of file thread.c.

◆ anonymous enum

anonymous enum
Enumerator
UB_ITER 

Definition at line 160 of file thread.c.

Function Documentation

◆ adopted()

static void* adopted ( void *  arg)
static

Definition at line 294 of file thread.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ forty_two_func()

static void forty_two_func ( const char *  s)
static

Definition at line 78 of file thread.c.

Here is the caller graph for this function:

◆ lambda42_func()

static void lambda42_func ( int  x)
static

Definition at line 88 of file thread.c.

Here is the caller graph for this function:

◆ lambda42_init()

static int lambda42_init ( int  x)
static

Definition at line 83 of file thread.c.

Here is the caller graph for this function:

◆ lambda_42_func()

static void lambda_42_func ( int  x)
static

Definition at line 97 of file thread.c.

Here is the caller graph for this function:

◆ lambda_42_init()

static int lambda_42_init ( int  x)
static

Definition at line 92 of file thread.c.

Here is the caller graph for this function:

◆ set_and_check_is_awkward()

static void set_and_check_is_awkward ( void  )
static

Definition at line 246 of file thread.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ t0()

static void t0 ( int  x)
static

Definition at line 40 of file thread.c.

Here is the caller graph for this function:

◆ t2()

static void t2 ( int  n)
static

Definition at line 48 of file thread.c.

Here is the caller graph for this function:

◆ t3()

static void t3 ( int  n)
static

Definition at line 59 of file thread.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_adopt()

static void test_adopt ( void  )
static

Definition at line 313 of file thread.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_is_awkward()

void test_is_awkward ( void  )

Definition at line 277 of file thread.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ test_thread()

void test_thread ( void  )

Definition at line 101 of file thread.c.

Here is the call graph for this function:

◆ threads_set0()

static void threads_set0 ( void  )
static

Definition at line 166 of file thread.c.

Here is the caller graph for this function:

◆ ub0()

static void ub0 ( int  x)
static

Definition at line 185 of file thread.c.

Here is the caller graph for this function:

◆ ub_fini()

static void ub_fini ( void  )
static

Definition at line 177 of file thread.c.

Here is the call graph for this function:

◆ ub_init()

static int ub_init ( const char *opts  M0_UNUSED)
static

Definition at line 171 of file thread.c.

Here is the call graph for this function:

◆ ub_join()

static void ub_join ( int  i)
static

Definition at line 196 of file thread.c.

Here is the call graph for this function:

◆ ub_join_all()

static void ub_join_all ( void  )
static

Definition at line 214 of file thread.c.

Here is the call graph for this function:

◆ ub_spawn()

static void ub_spawn ( int  i)
static

Definition at line 189 of file thread.c.

Here is the call graph for this function:

◆ ub_spawn_init()

static void ub_spawn_init ( int  i)
static

Definition at line 206 of file thread.c.

Here is the call graph for this function:

◆ ub_spawn_initcall()

static int ub_spawn_initcall ( int  x)
static

Definition at line 201 of file thread.c.

Here is the caller graph for this function:

◆ ut_t0_handler1()

static void ut_t0_handler1 ( int  arg)
static

Definition at line 268 of file thread.c.

Here is the call graph for this function:
Here is the caller graph for this function:

Variable Documentation

◆ m0_thread_ub

struct m0_ub_set m0_thread_ub
Initial value:
= {
.us_name = "thread-ub",
.us_init = ub_init,
.us_fini = ub_fini,
.us_run = {
{ .ub_name = "spawn",
.ub_iter = UB_ITER,
.ub_round = ub_spawn },
{ .ub_name = "join",
.ub_iter = UB_ITER,
.ub_round = ub_join,
.ub_fini = threads_set0 },
{ .ub_name = "spawn-init",
.ub_iter = UB_ITER,
.ub_round = ub_spawn_init,
.ub_fini = ub_join_all },
{ .ub_name = NULL }
}
}
#define NULL
Definition: misc.h:38
static void ub_join(int i)
Definition: thread.c:196
static void ub_spawn(int i)
Definition: thread.c:189
static void ub_spawn_init(int i)
Definition: thread.c:206
static void ub_fini(void)
Definition: thread.c:177
static int ub_init(const char *opts M0_UNUSED)
Definition: thread.c:171
static void ub_join_all(void)
Definition: thread.c:214
static void threads_set0(void)
Definition: thread.c:166

Definition at line 223 of file thread.c.

◆ r

int r[NR]
static

Definition at line 46 of file thread.c.

◆ synch

struct m0_semaphore synch
static

Definition at line 292 of file thread.c.

◆ t

struct m0_thread t[NR]
static

Definition at line 45 of file thread.c.

◆ t0place

int t0place
static

Definition at line 38 of file thread.c.

◆ t1place

char t1place[100]
static

Definition at line 76 of file thread.c.

◆ ubt

struct m0_thread ubt[UB_ITER]
static

Definition at line 164 of file thread.c.