Motr  M0
m0_thread Struct Reference

#include <thread.h>

Collaboration diagram for m0_thread:
Collaboration graph

Data Fields

enum m0_thread_state t_state
 
struct m0_thread_handle t_h
 
int(* t_init )(void *)
 
void(* t_func )(void *)
 
void * t_arg
 
struct m0_semaphore t_wait
 
int t_initrc
 
struct m0_thread_tls t_tls
 
char t_namebuf [M0_THREAD_NAME_LEN]
 

Detailed Description

Control block for a thread.

States

A thread control block can be in one of the following states:

  • PARKED: thread is not yet started or has been joined already. In this state m0_thread::t_func is NULL;
  • RUNNING: the thread started execution of m0_thread::t_func function, but hasn't yet been joined. Note that the thread can be in this state after return from m0_thread::t_func.

Concurrency control

A user is responsible for serialising access to a control block. For example, there should be no concurrent calls to m0_thread_init() or m0_thread_join() for the same m0_thread.

Liveness

Implementation only accesses control block as part of explicit calls to m0_thread interface functions. A user is free to destroy the control block at any moment, except for the possible resource leak in the case of running (and not yet joined) thread.

Definition at line 110 of file thread.h.

Field Documentation

◆ t_arg

void* t_arg

Definition at line 115 of file thread.h.

◆ t_func

void(* t_func) (void *)

Definition at line 114 of file thread.h.

◆ t_h

struct m0_thread_handle t_h

Definition at line 112 of file thread.h.

◆ t_init

int(* t_init) (void *)

Definition at line 113 of file thread.h.

◆ t_initrc

int t_initrc

Definition at line 117 of file thread.h.

◆ t_namebuf

char t_namebuf[M0_THREAD_NAME_LEN]

Definition at line 119 of file thread.h.

◆ t_state

enum m0_thread_state t_state

Definition at line 111 of file thread.h.

◆ t_tls

struct m0_thread_tls t_tls

Definition at line 118 of file thread.h.

◆ t_wait

struct m0_semaphore t_wait

Definition at line 116 of file thread.h.


The documentation for this struct was generated from the following file: