yumapro  20.10-14
YumaPro SDK
thd.h File Reference

Thread support (for now limited to netconfd) More...

#include <assert.h>
#include <stdio.h>
#include <xmlstring.h>
#include <pthread.h>
#include <sys/signal.h>
#include "procdefs.h"
#include "status.h"
#include "ses.h"
Include dependency graph for thd.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  thd_tcb_t
 Thread control block (TCB) More...
 

Enumerations

enum  thd_tcb_state_t {
  THD_TCB_STATE_NONE,
  THD_TCB_STATE_ACTIVE,
  THD_TCB_STATE_INACTIVE,
  THD_TCB_STATE_DELETED
}
 Thread (tcb) states. More...
 
enum  thd_type_t {
  THD_TYPE_NONE,
  THD_TYPE_BKGD,
  THD_TYPE_CONN,
  THD_TYPE_TMR,
  THD_TYPE_SES,
  THD_TYPE_DUMMY
}
 Thread types. More...
 

Functions

boolean thd_rcv_signal_setup (sigset_t *sigmask, thd_tcb_t *tcb)
 Init thread to receive omnibus signal. More...
 
void thd_check_shutdown_signal (sigset_t *sigmask, thd_tcb_t *tcb)
 The agt_shutdown_requested == TRUE at this point. More...
 
boolean thd_yield_for_cdx (int max_yield_count, uint usec, int ival, test_cdx_int_t sid_test_func)
 Yield scheduler in loop until specified condition(s) are met or max loop count is exceeded. More...
 
void thd_set_main_pthread_attr (void)
 Set/display main pthread attributes, to be inherited by all threads, unless otherwise noted. More...
 
status_t thd_master_init (void)
 Initialize all mutexes for use by threads. More...
 
void thd_set_main_handle (void)
 Record the thread handle of "main" (running initially before any threads are created) for reference. More...
 
thd_tcb_tthd_new_tcb (thd_type_t type)
 Allocate a new thread control block. More...
 
void thd_clear_locks (thd_tcb_t *tcb)
 Clear mutexes and RWLOCKs prior to termination. More...
 
void thd_mark_tcb_deleted (thd_tcb_t *tcb)
 Cleanup (release resources associated with a TCB) and free it. More...
 
void thd_shutdown (void)
 Begin thread ermination by signalling.
 
void thd_cleanup (boolean phase1)
 Terminate threads and deallocate associated resources, including thread control blocks. More...
 
thd_tcb_tthd_find_tcb_by_handle (pthread_t handle)
 Find a thread by its OS pthread handle. More...
 
thd_tcb_tthd_find_tcb_by_capability (uint cap)
 Find a TCB supporting the specified capability. More...
 
thd_tcb_tthd_find_tcb_by_type (thd_type_t type)
 Find a TCB supporting the specified type. More...
 
int thd_count_ses_threads (void)
 Count the number of session threads. More...
 
thd_tcb_tthd_find_tcb_by_sid (ses_id_t sid, boolean strict)
 Lookup TCB by session ID. More...
 
ses_id_t thd_find_sess_id_by_handle (pthread_t handle)
 Find the session ID represented by the thread handle. More...
 
ses_id_t thd_find_sess_id (void)
 Find the session ID represented by the current thread. More...
 
int thd_find_thread_id (void)
 Find the thread ID represented by the current thread. More...
 
thd_tcb_tthd_get_thread_tcb (void)
 Return the TCB of the current thread. More...
 
void thd_get_ids (int *tid, ses_id_t *sid)
 Return the TID and SID of the current running thread. More...
 
void thd_set_ready (void)
 Netconfd will set thd_ready when initialization is complete, but before creating threads. More...
 
int thd_lock_recursive_log_cs_mutex (void)
 Request lock on recursive logger CS (critical section) mutex. More...
 
int thd_unlock_recursive_log_cs_mutex (void)
 Unlock recursive logger CS (critical section) mutex. More...
 
int thd_lock_ses_sync_mutex (void)
 Request lock on session sync mutex (enforce session synchronization) More...
 
int thd_unlock_ses_sync_mutex (void)
 Unlock session sync mutex (enforce session synchronization) More...
 
int thd_lock_inreadyQ_mutex (ses_id_t sid)
 Request mutex lock for access to the inreadyQ (pending input). More...
 
int thd_unlock_inreadyQ_mutex (ses_id_t sid)
 Unlock mutex for access to the inreadyQ (pending input). More...
 
status_t thd_module_db_rdlock (thd_tcb_t *tcb)
 Request read access to the module DB ("object tree") More...
 
status_t thd_module_db_wrlock (thd_tcb_t *tcb)
 Request write access to the module DB ("object tree"). More...
 
status_t thd_module_db_unlock (thd_tcb_t *tcb)
 Unlock (release access) to the module DB ("object tree"). More...
 
thd_tcb_tthd_get_first_tcb (void)
 Get the first thread control block. More...
 
thd_tcb_tthd_get_next_tcb (thd_tcb_t *tcb)
 Get the next thread control block from the specified entry. More...
 

Detailed Description

Thread support (for now limited to netconfd)