Skip to main content
The 2024 Developer Survey results are live! See the results

All Questions

Tagged with
1 vote
0 answers
39 views

How to handle error creating threads in a loop

I'm into the Philosophers project, it is about handling threads and mutexes. For the project I need to create several threads, each thread runs a routine function and accesses shared resources. I ...
Ekaterina Mikhailova's user avatar
0 votes
0 answers
63 views

C program for calculating pi using pthread doesn't give a correct approximation

Below is some code I made that uses pthreads that calculates an approximation of pi. #include <stdio.h> #include <stdlib.h> #include <pthread.h> long num_terms; double sum = 0.0; ...
Sebastian Llaurador's user avatar
1 vote
1 answer
65 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
2 votes
2 answers
134 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
1 answer
61 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
1 vote
1 answer
49 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
72 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
2 votes
3 answers
75 views

Sending a SIGINT to specific thread with pthread_kill() results in whole process termination

I have a very big multithreaded C appication (for this and some other reasons I can not provide the entire code). Long story short, among others there are two threads: thread 1 sends SIGINT to thread ...
Kekers_Dev's user avatar
0 votes
1 answer
98 views

Shared data access in pthreads

My questions are : How many values ​​can the output of the following code take? What are these values? What is the reason for different values? How can we prevent different values ​​from occurring? #...
NB_1907's user avatar
  • 111
0 votes
2 answers
91 views

Using a mutex to stop start/stop multiple threads running the same function

My goal is this: I want to have multiple threads running the same function, the function is a while(1) loop so it just goes on. At some point main should use a mutex to force all threads to block ...
Jacknife's user avatar
2 votes
1 answer
93 views

How to Keep a Thread Alive After Main Function Ends in C on Windows?

Question: I'm working on a C project for Windows where I need to create a thread that runs independently of the main function. The goal is to ensure that this thread remains active even after the main ...
madeline's user avatar
0 votes
1 answer
73 views

Issue with synchronization of threads using condition variables to output the Mandelbrot

I try to syncronize threads with condition variables to output mandelbrot but i get wrong mandelbort. The functions output_mandel_line and compute_mandel_line are given and are correct. I made the ...
soa008's user avatar
  • 3
0 votes
1 answer
97 views

strange sporadic bugs in the most trivial C program involving pthreads

Below is the C source code for a trivial program. The program has a main loop where the user is asked to choose between 3 options: 1- print some text 2- do some work (with no side effects) 3- exit the ...
ForeverStudent's user avatar
2 votes
0 answers
65 views

Minilibx - multi-thread synchronization problem

I'm a student trying to use the minilibx library to render some graphics. I've split the rendering part and the calculation into two separate part, rendering part is a while loop constantly checking ...
아이스크림은메로나's user avatar
0 votes
1 answer
52 views

Threads barrier. Thread T6.13 can only end while 6 threads (including itself) are running [closed]

• Process’ main thread, i.e. T6.0 must not terminate before the other 43 threads. • At any time, at most 6 threads of process P6 could be running simultaneously, not counting the main thread. My code ...
locki's user avatar
  • 1

15 30 50 per page
1
2 3 4 5
328