上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 23 下一页
man文档描述: sa_mask gives a mask of signals which should be blocked during execution of the signal handler. In addition, the signal which triggered the h Read More
posted @ 2017-05-19 00:26 suonikeyinsu Views(3909) Comments(0) Diggs(2) Edit
NAME sigaction - examine and change a signal action SYNOPSIS #include <signal.h> int sigaction(int signum, const struct sigaction *act, struct sigacti Read More
posted @ 2017-05-18 23:46 suonikeyinsu Views(449) Comments(0) Diggs(0) Edit
早期的UNIX系统的一个特性:如果进程在执行一个低速系统调用而阻塞期间,捕捉到一个信号,则该系统调用就被中断而不再继续执行。该系统调用返回出错,其error被设置为EINTR。即信号中断系统调用的执行。这样处理的理由是:因为一个信号发生了,进程捕捉到了它,那么意味着已经发生了某种事情,所以是个唤醒 Read More
posted @ 2017-05-17 23:26 suonikeyinsu Views(1071) Comments(0) Diggs(0) Edit
之前一直以为pause就是将进程暂停,至于是怎么个暂停法,一直没有去深究。今天man了一下,才发现原来是wait for signal。 #include <unistd.h> int pause(void); DESCRIPTION The pause() library function cau Read More
posted @ 2017-05-14 21:38 suonikeyinsu Views(329) Comments(0) Diggs(0) Edit
信号的阻塞:通过sigprocmask()将信号集sigset_t中的信号设置为阻塞。SIG_BLOCK是指对相应信号的“递送阻塞”,内核在递送一个原来被阻塞的信号给进程时(而不是在产生该信号时),才决定对它的处理方式,那么进程在信号递送给它之前仍可改变对该信号的动作。 一个信号的"生命周期"为:产 Read More
posted @ 2017-05-13 15:01 suonikeyinsu Views(967) Comments(0) Diggs(0) Edit
对于fork函数的说明: 只共享代码段,但是数据段、堆、栈子进程也会从父进程中拷贝副本,但是并不是和父进程共享相关资源,而是在自己的进程空间中维护。 下面这个例子主要是针对“共享代码段”进行说明 运行结果: common部分的代码是很容易被忽视的地方。所以呢,为了防止代码复杂后导致common部分区 Read More
posted @ 2017-05-07 15:39 suonikeyinsu Views(291) Comments(0) Diggs(0) Edit
cleanup属性:当变量离开它的作用域时,设置的cleanup_function函数将被调用。 cleanup (cleanup_function) The cleanup attribute runs a function when the variable goes out of scope. Read More
posted @ 2017-04-29 23:20 suonikeyinsu Views(1124) Comments(0) Diggs(0) Edit
__attribute__的属性aligned,作用是为了设置字节对齐。 aligned是对 变量和结构体进行 字节对齐的属性设置。 通过aligned属性设置(aligned(对齐字节数)),可以显示的设置对齐字节数,如果使用缺省属性(aligned()),编译器会有一个默认的字节对齐数。 ali Read More
posted @ 2017-04-29 22:26 suonikeyinsu Views(3567) Comments(0) Diggs(0) Edit
1.什么是__attribute__? __attribute__机制是GNU C的一大特色,它可以设置函数属性、变量属性和类型属性等。可以通过它们向编译器提供更多数据,帮助编译器执行优化等。 2.__attribute__语法格式? https://gcc.gnu.org/onlinedocs/g Read More
posted @ 2017-04-29 21:40 suonikeyinsu Views(666) Comments(0) Diggs(0) Edit
typeof是GNU c标准的关键字。 typeof()的作用是自动推导出括号中表达式的数据类型。 附加知识点: line 92包含两个知识点, 1.warning: statement with no effect c语言中语句(statement)的用法, 正如104行,如果是 "12;"gcc Read More
posted @ 2017-04-27 23:50 suonikeyinsu Views(554) Comments(0) Diggs(0) Edit
上一页 1 ··· 9 10 11 12 13 14 15 16 17 ··· 23 下一页