produce.c

来自「多线程库」· C语言 代码 · 共 25 行

C
25
字号
#define __THREADS_MAIN#include <thread.h>#include <string>extern "C" {#  include <unistd.h>};main(){  cond t_control(attributes::process_shared);  mutex t_link(attributes::process_shared);  char *buf = (char *)pthread::shalloc(80);  t_link.lock();  cout << "Enter text for consumer: ";  cout.flush();  cin.getline(buf,80);  t_control.signal();  t_link.unlock();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?