Top "Pthreads" questions

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

How to print pthread_t

Searched, but don't come across a satisfying answer. I know there's no a portable way to print a pthread_t. …

c++ c linux pthreads
pthread function from a class

Let's say I have a class such as class c { // ... void *print(void *){ cout << "Hello"; } } And then I …

c++ pthreads
When to use pthread_exit() and when to use pthread_join() in Linux?

I am new to pthreads, and I am trying to understand it. I saw some examples like the following. I …

c linux pthreads
Mutex lock threads

Am new to multi threaded/processs programming. So here's what I need to clarify. Process A code pthread_mutex_lock() …

c linux pthreads mutex multiprocess
How do you query a pthread to see if it is still running?

In my destructor I want to destroy a thread cleanly. My goal is to wait for a thread to finish …

c multithreading concurrency pthreads destructor
How to increase thread priority in pthreads?

I am using pthread in Linux. I would like to increase the thread priority by setting the parameters sched_param.…

c++ linux multithreading pthreads
Kill Thread in Pthread Library

I use pthread_create(&thread1, &attrs, //... , //...); and need if some condition occured need to kill this thread how …

c multithreading pthreads posix
Significance of -pthread flag when compiling

In various multi threaded C and C++ projects I've seen the -pthread flag applied to both the compiling and linking …

c++ c linux pthreads
C++11 std::threads vs posix threads

Why should I prefer one or another in practice? What are technical differences except that std::thread is a class?

c++ multithreading c++11 pthreads
pthread_create and passing an integer as the last argument

I have the following functions : void *foo(void *i) { int a = (int) i; } int main() { pthread_t thread; int i; …

c pthreads