util.h

来自「linux环境下用纯c写的RTP协议的通用开发库」· C头文件 代码 · 共 39 行

H
39
字号
/*------------------------------------------------------------------------- * util.h - align, hton24 *------------------------------------------------------------------------- */#ifndef UTIL_H#define UTIL_H#include <time.h>#include <rtp.h>/* thread states */#define THR_NOTRUNNING   0#define THR_INITIALIZING 1#define THR_RUNNING      2#define THR_TERMINATE    3#define UTIL_STOPTHREADDELTA {0, 10000000} /* 10 ms */#define UTIL_STOPTHREADMAXTRIES 15	   /* max signals to send *//* Misc utilities */#define align(val, align) (val + (val % align != 0 ? align - (val % align) : 0))#define hton24(v)            (((v&0xff) << 16) | (v&0xff00) | ((v&0xff0000)>>16))/* Time utilities */struct timespec timesub(struct timespec, struct timespec);struct timespec timeadd(struct timespec, struct timespec);mediatime_t timeflatten(struct timespec, int);struct timespec timeunflatten(mediatime_t, int);int timecmp(struct timespec, struct timespec);/* Thread utilities */int startthread(pthread_t *, void *(*)(void *), void *, pthread_mutex_t *, pthread_cond_t *, int *);int stopthread(pthread_t *, pthread_mutex_t *, pthread_cond_t *, int *);/* signal handler */void nullfcn(int);#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?