thread_lists.c

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

C
56
字号
#include <thread_mutex.h>#include <thread.h>#include <thread_lists.h>#include <thread_signal_num.h>extern "C" {#  include <signal.h>};thread_list::iteratorthread_list::locate(int id){  iterator i;  for(i=begin();i!=end();i++)    if ((*i)->id() == id)      return i;  return end();}void thread_list::remove(int id){  iterator i = locate(id);  if (i != end())    erase(i);}void thread_list::restart(int id){  kill(id, PTHREAD_SIG_RESTART);}void thread_list::suspend(int id){  iterator i = locate(id);  if (i != end())    (*i)->suspend();} pthread *thread_list::self(){  iterator i = locate(getpid());  if (i != end())    return (*i);  return 0;}

⌨️ 快捷键说明

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