Skip to main content

Questions tagged [pthreads]

Pthreads (POSIX Threads) is a standardised C-based API for creating and manipulating threads. It is currently defined by POSIX.1-2008 (IEEE Std 1003.1, 2013 Edition / The Open Group Base Specifications Issue 7).

pthreads
0 votes
1 answer
18 views

How should I initialize pthread mutexes in shared memory, since at program start they can be already initialized?

I'm using shared, robust pthread mutexes to protect some shared memory areas I have in my application. Since my program is managed by a systemd service, it could potentially be restarted, in which ...
Alessandro Bertulli's user avatar
0 votes
1 answer
25 views

If the Linux kernel reassigns a PID, can this cause errors/UB when using C pthread mutexes?

If I'm getting it right, is it possible in the Linux pthread C API to use robust mutexes, that can be shared across processes (by placing them in shared memory), and that allows you to acquire the ...
Alessandro Bertulli's user avatar
-4 votes
0 answers
62 views

negative value in __writer member variable of struct pthread_rwlock_t [closed]

I am debugging one deadlock case in my application running on RHEL 7(glibc 2.17). When inspecting using gdb, at the time of deadlock, I see the following values on printing std::shared_timed_mutex(...
Vishal Sharma's user avatar
1 vote
1 answer
58 views

Thread asynchronous waiting signaling

I need a C code for a program which N threads can communicate with eachother. each thread id can wait for whichever thread id it wants. each thread id can signal which ever thread id it wants. they ...
Emil Akesson's user avatar
1 vote
1 answer
78 views

Can pthread_exit be used with noexcept functions?

I have a model where minimal work happens on main thread, and almost all work happens on worker threads. I want to ensure that the main thread NEVER dies and ALWAYS returns back to the OS. Since, all ...
Wolfie's user avatar
  • 101
2 votes
2 answers
131 views

Repeated short identical parallel jobs

I have an algorithm that requires many parallel reruns of the same code. The code is short and finishes in less than a microsecond. This will be run millions of times which creates some problems when ...
user2908112's user avatar
0 votes
0 answers
31 views

pthreads_cross.h error: conflicting declaration of C function from pthread.h

I have a cmake project where I'm using vcpkg as a package manager. One of the dependencies I need is the apriltag dependency which is dependent on the pthread dependency. the project seems to ...
Elliot Scher's user avatar
0 votes
1 answer
60 views

Can I run the Pthreads library directly on a virtual machine

So, I have installed a virtual machine (kali linux), I would like to know if I can complete my assignment, which requires multiple processes to be created and managed using Pthreads library in C. She ...
sampath sai charan's user avatar
2 votes
1 answer
14 views

What does it mean for CMake to find a "pthread-compatible" library?

CMake's FindThreads script documentation says that the variable CMAKE_USE_PTHREADS_INIT will be set "if the found thread library is pthread compatible." What does that mean? If it's an ...
einpoklum's user avatar
  • 127k
0 votes
0 answers
17 views

CMake Error: Could Not Find pthread Library While Installing ns-allinone-3.37 and opengym

I installed ns-allinone-3.37 and the opengym library in the /home/chae/ns-allinone-3.37/ns-3.37 directory. The next step was to run the command cmake . in that directory. (ns3-gym-env) chae@chae-B660M-...
채희주인공지능학과's user avatar
1 vote
1 answer
48 views

problem using pthread_cond_signal and pthread_cond_timedwait

I have a small program with two threads sending signal to each other. The program first works as expected but stop after various runs as the pthread_cond_timedwait run into a timeout. For my test I ...
paperwork's user avatar
1 vote
0 answers
70 views

How to manage responses from multiple measuring devices to a single TCP/IP port for time sensitive applications?

I am very new to Socket programming, and I would appreciate any input you have in my question. I am a physicist working on a project where the time intervals and coincidence of measurements play a big ...
Sougandh Km's user avatar
1 vote
0 answers
31 views

pthread_cancel on blocking read doesn't work

Simple code snippet hanging forever: #include <csignal> #include <mutex> #include <print> #include <iostream> void *routine(void *arg) { pthread_setcancelstate(...
Nikolay Mikhaylov's user avatar
2 votes
1 answer
61 views

Trying to implement a barrier for pthreads in C++ using pthread condition variables and mutexes

I am currently trying to implement a barrier to control a group of threads. Te barrier class needs a constructor, destructor, and the wait method which I believe I have already created correcty. The ...
Khalid Abdallah's user avatar
0 votes
1 answer
48 views

Why can't I lock a mutex in one thread an unlock it in another one? [closed]

I wrote the following openmp code: omp_set_lock(&lock); #pragma omp task { do_work(); omp_unset_lock(&lock); } and it seems to work. However, the omp standard says that only a ...
Yuliy Daniel's user avatar

15 30 50 per page
1
2 3 4 5
598