Pthreads (POSIX Threads) is a standardised C-based API for creating and manipulating threads on a POSIX-compliant system. It is defined by the standard "POSIX.1c, Threads extensions (IEEE Std 1003.1c-1995)", and subsequently by the Single Unix Specification.
6
votes
1answer
379 views
Threading lambda functions
I've created this very small header that allows direct creation of threads from lambdas.
I can't find anything else similar on the net so I want to know whether there are any problems with this that I ...
4
votes
1answer
84 views
Please review for - any unnecesary casting, memory leaks,wrong use of pthread call, or validation problem is there in the given code fragment
/**********************************************************************
* FILENAME :thread_1.c
* DESCRIPTION:Contains Code for a program that demonstrates the
* use of pthread ...
0
votes
2answers
655 views
Mutex locker class in C++
What needs to be corrected, added, or subtracted here?
class mutexLocker
{
private:
/* Declaration of a Mutex variable `mutexA`. */
pthread_mutex_t &mutexA;
/* `mutexStatus` ...
0
votes
1answer
99 views
Usage of Conditions Variables with Pthreads
This is just a program to show the use of condition variable when two threads are involved. One thread wants a non zero value of count, and other thread is responsible for signaling it when the count ...
1
vote
1answer
202 views
std::lock implementation in C with pthreads
I messed a little bit with pthreads and needed an alternative to the C++11 function std::lock (2 args are enough), this is what I came up with:
void lock(pthread_mutex_t* m1, pthread_mutex_t* m2) {
...
8
votes
2answers
146 views
Is there a better way to thread this class function?
I have a class bar that keeps track of N instances of class foo in a std::map (so N = map.size()).
When I call bar::func I want to have N threads that call foo::foo_func.
foo::foo_func requires ...
2
votes
2answers
396 views
Thread design for sending data to multiple servers?
Language: C++
Thread library: PThreads
In the following code, checkServerExists function checks if the server exists in the vector.
If it does, then the new message is directly pushed in the vector, ...
3
votes
2answers
96 views
Review a newbie's pthread code
I'm a pthread newbie and I've been giving myself a challenge: I want to have a resource that multiple threads can access at the same time as read. However, if a thread wants to write, then this need ...
