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.

learn more… | top users | synonyms

4
votes
1answer
381 views

Vehicle-crossing simulation

It seems like this code should be shorter, but with all the error checking it is long and hard to follow. This is for a simulation of vehicles crossing a bridge, and this part is dealing with mutexes. ...
4
votes
2answers
93 views

Example of a Multithreaded C program

In answering password cracker in c with multithreading, I ended up writing a sample in C, which is not my forte. Is there anything that I missed which should have been included in a responsible ...
2
votes
0answers
35 views

Synchronous event library

I have implemented a small library that handles synchronous events with POSIX-compliant threads. I have oriented this with the already existing POSIX thread API. Here are the files I created: ...
3
votes
0answers
54 views

Synchronous events library

I have implemented a small library that handles synchronous events with POSIX compliant threads. I oriented me on the already existing POSIX thread API. Here are the files I created: ...
3
votes
1answer
64 views

Consumer producer implementation involving POSIX, semaphores, and locks

I am trying to get over my fear of multithreading programming and teaching myself to code using POSIX. I wrote a small version of the consumer producer problem. I am hoping I can get some feedback if ...
5
votes
1answer
496 views

Consumer-Producer Problem: POSIX Thread

I have implemented a producer consumer problem, following the resources below: Oracle doc CSEE I have used mutex_t and ...
5
votes
1answer
142 views

Scalability of C server implementation based on pthreads

I am wondering about the feasibility of the following basic implementation of a server and how well it would scale. I know that large-scale, distributed servers should probably be written in a ...
10
votes
1answer
5k views

Thread-safe concurrent FIFO queue in C++

Is this the correct way to implement a thread-safe concurrent FIFO queue in C++? It requires passing unsigned char* arrays of binary data. Thread Safe Concurrent ...
2
votes
1answer
98 views

1 Producer, N Consumers working in parallel, each doing ~1/nth of a task

I am not wondering about error checking (I will add that soon). I would instead like to know about correctness, efficiency and simplicity. ...
7
votes
3answers
7k views

Dining philosophers problem with mutexes

I know this dining philosophers problem has been researched a lot and there are resources everywhere. But I wrote a simple code to solve this problem with C and then turned to Internet to see if it's ...
4
votes
1answer
64 views

Uses of barriers for one main thread controlling n threads

Referring to this post, my problem (summarized): One main thread waits for connections, on accept() spawns a new thread for each connection. After we received ...
1
vote
4answers
1k views

Concurrent queue with pthread implementation

I'm writing a multi-threaded queue implemented with pthreads. Since I came up with the code based on several tutorials from Internet, I would like to make sure there are no logic errors in my code: ...
2
votes
1answer
315 views

Multithreaded GPS system

I am trying to reduce the total execution time of my code. I have a GPS system which calculates routes between two points, and returns all points in between them. I did a simple profile and the ...
10
votes
1answer
2k 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
104 views

Demonstration of pthread calls

Please review for any unnecessary casting, memory leaks, wrong use of pthread call, or validation problems in the given code. ...
0
votes
2answers
1k views

Mutex locker class in C++

What needs to be corrected, added, or subtracted here? ...
0
votes
1answer
202 views

Usage of Conditions Variables with Pthreads [on hold]

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 ...
2
votes
1answer
305 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), and this is what I came up with: ...
2
votes
2answers
550 views

Thread design for sending data to multiple servers

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
4answers
4k views

Linux C++ Timer Class: How can I improve the accuracy?

I wrote this class today, but I am trying to figure out how to make it more accurate. I pass in seconds and multiply by 1000 to make it milliseconds, and the time does not line up. I need the ability ...
3
votes
1answer
864 views

Seperate rendering thread with XLib (GLX) and OpenGL

I am writing a prototype for something at work. Not very many people here know much about Linux/Unix or Xlib so I can't really ask here at work (most developers are expert Windows programmers). With ...
3
votes
2answers
216 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 ...
6
votes
1answer
3k views

Multithreading algorithm for high performance parallel computing and Producer-Consumer queue using POSIX threads

The following is the producer-consumer algorithm for a piece of software that I'm upgrading to take advantage of multi-core processing. The intended platform is some flavor of Linux running on an EC2 ...