Skip to content

[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
wants to merge 36 commits into
base: master
Choose a base branch
from
Open

[pull] master from XMuli:master #15

wants to merge 36 commits into from

Conversation

pull[bot]
Copy link

@pull pull bot commented Jun 30, 2023

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 : )

@pull pull bot added ⤵️ pull merge-conflict Resolve conflicts manually labels Jun 30, 2023
ljhcage and others added 20 commits December 25, 2024 22:11
 函数:

 //发射信号给指定进程、或者同组的信号。
 - 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()     //同上,多一个额外功能,运行期间能够**临时** 屏蔽指定信号
XMuli added 4 commits April 30, 2025 00:28
 使用读写锁的一个标准大概流程(所有线程都要加锁):
- 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()  //通知阻塞的消费者线程,解除阻塞
@XMuli XMuli force-pushed the master branch 2 times, most recently from e5d9fa6 to e48810f Compare June 17, 2025 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
⤵️ pull merge-conflict Resolve conflicts manually
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants