Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Thread{
- protected:
- pthread_t thread;
- public:
- void start();
- void run();
- static void* runWrapper(void *threadClass){
- ((Thread*)threadClass)->run();
- };
- void stop();
- };
- void Thread::run(){
- printf("lol");
- }
- void Thread::start(){
- long t = 0;
- int rc;
- rc = pthread_create(&thread, NULL, runWrapper, (void*)this);
- if (rc){
- printf("ERROR; return code from pthread_create() is %d\n", rc);
- exit(-1);
- }
- }
- void Thread::stop(){
- pthread_exit(NULL);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement