# multi_thread **Repository Path**: clangwu/multi_thread ## Basic Information - **Project Name**: multi_thread - **Description**: (已完结)windows多线程模板仓库 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2022-03-21 - **Last Updated**: 2022-04-26 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Multi-Thread template **Attention:** This template NOW is only for Windows, but is easy to be modified for Linux with a few lines changed. If you need some help, feel free to email ClangWU(clangwu@163.com) . 1. Include **sys_thread.hpp** 2. Inherit class **CThread** ```c++ class master_thrd: public CThread{ public: master_thrd(int *i, std::string thread_mame, ThreadType thread_type, ThreadStartType start_type); ~master_thrd(); private: void init(); void task(); void clean_up(){;} int *_var; }; class slave_thrd: public CThread{ public: slave_thrd(int *i, std::string thread_mame, ThreadType thread_type, ThreadStartType start_type); ~slave_thrd(); private: void init(); void task(); void clean_up(){;} int *_var; }; ``` 3. Instantiate the **subclass** ```c++ master_thrd _master(&i, "master", ThreadType::MASTER, ThreadStartType::instant_create); slave_thrd _slave(&i, "slave", ThreadType::SLAVE, ThreadStartType::instant_create); ```