标签:style blog color io os ar 使用 for strong
The <signal.h> header shall define the sigevent structure, which shall include at least the following members:
struct sigevent { int sigev_notify; //Notification type. int sigev_signo; //Signal number. union sigval sigev_value; //Signal value. void (*sigev_notify_function)(union sigval); //Notification function. pthread_attr_t *sigev_notify_attributes; //Notification attributes. };
sigev_notify 的取值范围如下,只有3种情况(对应的宏在<signal.h>中定义)。
在sigev_notify = SIGEV_SIGNAL 时使用,指定信号的种别(number).
在sigev_notify = SIGEV_THREAD 时使用,作为sigev_notify_function 的参数.
union sigval { int sival_int; void *sival_ptr; };
函数指针(指向通知执行函数),在sigev_notify = SIGEV_THREAD 时使用, 其他情况下置为NULL.
指向线程属性的指针,在sigev_notify = SIGEV_THREAD 时使用,指定创建线程的属性, 其他情况下置为NULL.
The <time.h> header shall declare the timespec structure, which shall include at least the following members:
struct timespec { time_t tv_sec; /* Seconds */ long tv_nsec; /* Nanoseconds(纳秒:十亿分之一秒) */ };
The <time.h> header shall also declare the itimerspec structure, which shall include at least the following members:
struct itimerspec { struct timespec it_interval; /* Timer interval(timer循环时间间隔) */ struct timespec it_value; /* Initial expiration(timer初次到期时间) */ };
clockid_t is used for clock ID type in the clock and timer functions, 取值范围如下(前4个是POSIX定义的,灰色部分为Linux的扩展),
/* Identifier for system-wide realtime clock, Setting this clock requires appropriate privileges */ #define CLOCK_REALTIME 0 /* Monotonic system-wide clock, Clock that cannot be set and represents monotonic time since some unspecified starting point */ #define CLOCK_MONOTONIC 1 /* High-resolution timer from the CPU. */ #define 2 /* Thread-specific CPU-time clock. */ #define CLOCK_THREAD_CPUTIME_ID 3 /* Monotonic system-wide clock, not adjusted for frequency scaling. */ #define CLOCK_MONOTONIC_RAW 4 /* Identifier for system-wide realtime clock, updated only on ticks. */ #define CLOCK_REALTIME_COARSE 5 /* Monotonic system-wide clock, updated only on ticks. */ #define CLOCK_MONOTONIC_COARSE 6
CLOCK_REALTIME : 这种时钟表示的是绝对时间, 指的是从1970年1月1月0:00到目前经过多少秒, 相当于你的linux系统中显示的时间, 所以这个时间是可以更改的, 当系统的时钟源被改变,或者系统管理员重置了系统时间之后,这种类型的时钟可以得到相应的调整, 对设定为此类型的timer是有影响的.
CLOCK_MONOTONIC : 这种时钟表示的是相对时间, 其值对通过累积时钟节拍(嘀嗒)计算出来的, 不受时钟源等的影响, 从系统启动这一刻起开始计时, 如果你想计算出在一台计算机上不受重启的影响,两个事件发生的间隔时间的话,那么它将是最好的选择。
CLOCK_PROCESS_CPUTIME_ID : 本进程到当前代码系统CPU花费的时间
CLOCK_THREAD_CPUTIME_ID : 本线程到当前代码系统CPU花费的时间
标签:style blog color io os ar 使用 for strong
原文地址:http://www.cnblogs.com/LubinLew/p/POSIX-DataStructure.html