# C-selfLib **Repository Path**: bossagit11/C-selfLib ## Basic Information - **Project Name**: C-selfLib - **Description**: No description available - **Primary Language**: C++ - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2021-12-13 - **Last Updated**: 2022-11-20 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # C-selfLib > 1. It's a c++ libs for self management. > 2. base on c++ v-11. ## 1. Thread Thread lib is a decoration for the linux pthread api, just for using convenience. Usage simple example: ```cpp //If you need a mutex. static MUTEX defaultGlobalMutex = PTHREAD_MUTEX_INITIALIZER; int main() { /*1. Create a Thread and implement it's onLoop super interface.*/ class MyThread : public Thread{ virtual bool onLoop() { Thread::AutoMutex lock(&defaultGlobalMutex); std::cout << "MyThread onLoop" << std::endl; sleep(2); return true; } }; /*2. Instantiate the thread you create.*/ MyThread thread; /*Just start*/ thread.start(); thread.join(); return 0; } ```