102 .sd_name =
"initial",
105 .sd_invariant =
NULL,
110 .sd_name =
"terminal",
113 .sd_invariant =
NULL,
123 .scf_name =
"test drive: transition",
124 .scf_nr_states =
S_NR,
240 .sd_name =
"initial",
243 .sd_invariant =
NULL,
251 .sd_invariant =
NULL,
259 .sd_invariant =
NULL,
267 .sd_invariant =
NULL,
272 .sd_name =
"terminal",
275 .sd_invariant =
NULL,
391 .sd_name =
"initial",
394 .sd_invariant =
NULL,
399 .sd_name =
"loop here",
402 .sd_invariant =
NULL,
407 .sd_name =
"Let's go out to the field",
410 .sd_invariant =
NULL,
415 .sd_name =
"terminal",
418 .sd_invariant =
NULL,
423 .scf_name =
"test drive: group",
424 .scf_nr_states =
S_NR,
443 while (
s.abel.sm_rc == 0) {
515 .sd_name =
"initial",
518 .sd_invariant =
NULL,
523 .sd_name =
"flip a coin",
526 .sd_invariant =
NULL,
531 .sd_name =
"Head, I win!",
534 .sd_invariant =
NULL,
539 .sd_name =
"Tail, you lose!",
542 .sd_invariant =
NULL,
547 .sd_name =
"round done",
550 .sd_invariant =
NULL,
555 .sd_name =
"game over",
558 .sd_invariant =
NULL,
563 .sd_name =
"tails win",
566 .sd_invariant =
NULL,
571 .sd_name =
"tails lose",
574 .sd_invariant =
NULL,
582 .sd_invariant =
NULL,
590 .scf_name =
"test drive: chain",
591 .scf_nr_states =
C_NR,
static void transition(void)
M0_INTERNAL void m0_chan_wait(struct m0_clink *link)
M0_INTERNAL void m0_sm_conf_init(struct m0_sm_conf *conf)
M0_INTERNAL void m0_sm_fail(struct m0_sm *mach, int fail_state, int32_t rc)
M0_INTERNAL void m0_mutex_unlock(struct m0_mutex *mutex)
static struct m0_mutex wait_guard
int m0_thread_join(struct m0_thread *q)
void(* sa_cb)(struct m0_sm_group *grp, struct m0_sm_ast *)
const m0_time_t M0_TIME_NEVER
static struct m0_sm_group * grp
M0_INTERNAL void m0_sm_timeout_init(struct m0_sm_timeout *to)
static void timeout(void)
static int over(struct m0_sm *mach)
M0_INTERNAL void m0_sm_ast_wait(struct m0_sm_ast_wait *wait)
M0_INTERNAL void m0_sm_ast_post(struct m0_sm_group *grp, struct m0_sm_ast *ast)
static struct m0_sm_ast ast
static int flip(struct m0_sm *mach)
M0_INTERNAL void m0_sm_ast_wait_init(struct m0_sm_ast_wait *wait, struct m0_mutex *ch_guard)
static struct m0_addb2_mach * mach
#define M0_THREAD_INIT(thread, TYPE, init, func, arg, namefmt,...)
#define container_of(ptr, type, member)
M0_INTERNAL void m0_mutex_lock(struct m0_mutex *mutex)
M0_INTERNAL void m0_sm_group_fini(struct m0_sm_group *grp)
M0_INTERNAL int m0_sm_timedwait(struct m0_sm *mach, uint64_t states, m0_time_t deadline)
static int head(struct m0_sm *mach)
static struct m0_sm_state_descr tmo_states[S_TMO_NR]
M0_INTERNAL void m0_sm_group_unlock(struct m0_sm_group *grp)
static void ast_thread(int __d)
static void ast_wait_cb(struct m0_sm_group *grp, struct m0_sm_ast *ast)
M0_INTERNAL uint64_t m0_rnd(uint64_t max, uint64_t *seed)
static void ast_cb(struct m0_sm_group *g, struct m0_sm_ast *a)
static void ast_test(void)
static struct m0_thread ath
M0_INTERNAL void m0_sm_group_init(struct m0_sm_group *grp)
void m0_sm_state_set(struct m0_sm *mach, int state)
static struct m0_sm_ast_wait wait
M0_INTERNAL void m0_clink_signal(struct m0_clink *clink)
M0_INTERNAL void m0_mutex_init(struct m0_mutex *mutex)
struct m0_sm_ast * sa_next
static void ast_wait(void)
M0_INTERNAL int m0_sm_timeout_arm(struct m0_sm *mach, struct m0_sm_timeout *to, m0_time_t timeout, int state, uint64_t bitmask)
static int genesis_4_8(struct m0_sm *mach)
M0_INTERNAL void m0_sm_ast_wait_post(struct m0_sm_ast_wait *wait, struct m0_sm_group *grp, struct m0_sm_ast *ast)
M0_INTERNAL void m0_sm_timeout_fini(struct m0_sm_timeout *to)
M0_INTERNAL void m0_sm_init(struct m0_sm *mach, const struct m0_sm_conf *conf, uint32_t state, struct m0_sm_group *grp)
static struct m0_sm_trans_descr trans[]
m0_time_t m0_time_from_now(uint64_t secs, long ns)
M0_INTERNAL void m0_sm_ast_wait_fini(struct m0_sm_ast_wait *wait)
M0_INTERNAL void m0_sm_move(struct m0_sm *mach, int32_t rc, int state)
M0_INTERNAL void m0_mutex_fini(struct m0_mutex *mutex)
static struct m0_sm_group G
M0_INTERNAL void m0_sm_group_lock(struct m0_sm_group *grp)
M0_INTERNAL void m0_sm_ast_cancel(struct m0_sm_group *grp, struct m0_sm_ast *ast)
M0_INTERNAL void m0_sm_asts_run(struct m0_sm_group *grp)
static struct gen g[MAX_GEN]
static struct m0_addb2_source * s
M0_INTERNAL void m0_sm_ast_wait_signal(struct m0_sm_ast_wait *wait)
static struct m0_sm_state_descr states[C_NR]
static int tail(struct m0_sm *mach)
static const struct m0_sm_conf tmo_sm_conf
M0_INTERNAL void m0_sm_fini(struct m0_sm *mach)