forked from XMuli/QtExamples
-
Notifications
You must be signed in to change notification settings - Fork 0
[pull] master from XMuli:master #15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
pull
wants to merge
36
commits into
lisuke:master
Choose a base branch
from
XMuli:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
函数: //发射信号给指定进程、或者同组的信号。 - int kill(pid_t pid, int sig); //自己给自己发射信号。在单线程程序中,它相当于 kill(getpid(), sig); //在一个多线程程序中,它等同于 pthread_kill(pthread_self(), sig)。 - int raise(int sig); //给自己发送异常终止的信号。该函数没有参数和返回值,也永远不会调用失败。 - void abort(void); //设置定时器(每一个进程只有一个定时器) - unsigned int alarm(unsigned int seconds); //定时器,并且实现 周期性 定时。 - int setitimer(int which, const struct itimerval *new_value, struct itimerval *old_value);
- 自定义信号集: - sigaddset() //将指定信号置为 1,添加到自定义集中 - sigdelset() //将指定信号置为 0,添加到自定义集中 - sigemptyset() //将所有信号置为 0,清空 - sigfillset() //将所有信号置为 1,填充 - sigismember() //判断指定信号是否存在,是否为 1 - 系统信号集: - sigprocmask() //将自定义信号集设置给阻塞信号集。 - sigprocmask() //读取当前信号的未决信号集。参数为输出参数,内核将未决信号集写入 set - 信号捕捉: - signal() //实现信号捕捉的功能;最简单使用一个函数。 - sigaction() //同上,多一个额外功能,运行期间能够**临时** 屏蔽指定信号
使用读写锁的一个标准大概流程(所有线程都要加锁): - pthread_rwlock_init() - pthread_rwlock_rdlock() / pthread_rwlock_tryrdlock() / pthread_rwlock_wrlock() / pthread_rwlock_trywrlock() - 、、、代码 片 - pthread_rwlock_unlock() - pthread_rwlock_destroy()
pthread_cond_t g_cond; //条件变量--阻塞线程,等待条件满足 pthread_cond_wait() //阻塞线程,且该函数会对互斥锁解锁;且接解除阻塞之后,对互斥锁进行加锁操作 pthread_cond_signal() //通知阻塞的消费者线程,解除阻塞
e5d9fa6
to
e48810f
Compare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.2)
Can you help keep this open source service alive? 💖 Please sponsor : )