POSIX threads (pthread) are a major specification for a threading API on POSIX-compatible systems, like UNIX or Linux. By default, Windows doesn’t support pthreads, but MinGW packages a third-party native implementation.

API

  • pthread_create:
    • start_routine: function pointer, takes a single void ptr (type-agnostic pointer to memory) and returns a pointer
  • pthread_join — equivalent of process wait syscall
  • pthread_exit — equivalent of exit
  • pthread_detach — mark thread as detached