Top "Pthreads" questions

Pthreads (POSIX Threads) is a standardised C-based API for creating and manipulating threads.

Signal handling in pthreads

I have created a pthread, and installed a signal handler inside that, same way as we do in main( ) function. …

c pthreads signals
PTHREAD_MUTEX_INITIALIZER vs pthread_mutex_init ( &mutex, param)

Is there any difference between pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER; Or pthread_mutex_t lock; pthread_mutex_init ( &…

c ubuntu pthreads mutex
pthreads mutex vs semaphore

What is the difference between semaphores and mutex provided by pthread library ?

c linux synchronization pthreads mutex
pthread sleep linux

I am creating a program with multiple threads using pthreads. Is sleep() causing the process (all the threads) to stop …

c++ multithreading pthreads
Why do pthreads’ condition variable functions require a mutex?

I’m reading up on pthread.h; the condition variable related functions (like pthread_cond_wait(3)) require a mutex as …

c pthreads mutex condition-variable
efficient thread-safe singleton in C++

The usual pattern for a singleton class is something like static Foo &getInst() { static Foo *inst = NULL; if(inst == …

c++ singleton thread-safety pthreads
How do I get a thread ID from an arbitrary pthread_t?

I have a pthread_t, and I'd like to change its CPU affinity. The problem is that I'm using glibc 2.3.2, …

c linux unix pthreads system-calls
Program received signal SIGPIPE, Broken pipe

I write a client program based on posix sockets. The program creates multiple threads and is going to lock the …

c sockets gdb pthreads sigpipe
Building error using cmake: cannot find -lpthreads

I have c++ project that was smoothly running on a given machine, and now I am trying to compile it …

c++ linux cmake pthreads
Why is a while loop needed around pthread wait conditions?

I'm learning pthread and wait conditions. As far as I can tell a typical waiting thread is like this: pthread_…

c multithreading pthreads