Skip to content

cnsuhao/threadpp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 

Repository files navigation

threadpp

Light-weight cross-platform thread/mutex implementations including win32, win8,linux,macOS,iOS,android.

Features

Threads.
Locks.
Recursive locks.
Condition variables (integrated with lock).

##Advantages Extremely light weight.
Headers only (No compilation pitfalls).
Cross platform (Windows, any POSIX compatible OS or any C++11 supported platforms)
No preprocess macros needed.
Compatible with prior C++11 compilers.

Sample:

#include "threadpp.h"

using namespace threadpp;

recursivelock l;

void thread_callback(void* context) {

l.lock();

l.wait();//wait-notify paradigm,will be wake up by main in 3 seconds

printf("hello from thread:%llu\n",thread::current_thread_id());

l.unlock();

}

int main(int argc,const char** argv) {

thread t(thread_callback,NULL);

thread::sleep(3000);

l.notify_all();//wait-notify paradigm.

t.join();

}

About

Light-weight cross-platform thread/mutex implementations including win32, win8,linux,macOS,iOS,android.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 96.8%
  • C 3.2%