consume.c
来自「用c++包装好的线程库,直接拿来使用,提高效率.」· C语言 代码 · 共 30 行
C
30 行
#define __THREADS_MAIN#include <thread.h>#include <string>#include <iostream>extern "C" {# include <unistd.h>};using namespace std;using namespace cpp_threads;main(){ Cond t_control(attributes::process_shared_e); Mutex t_link(attributes::process_shared_e); char *buf = (char *)Pthread::shalloc(80); t_link.lock(); t_control.wait(t_link); cout << "Consumed: '" << buf << "'\n"; t_link.unLock();}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?