Most voted "pthreads" questions
8 questions
Sort by count of
-
1
votes1
answer169
viewsDifferent behaviors between Linux and Windows using threads(pthreads)
I’m using the Linux pthreads library to try out the functionality of threads, the code below prints 5 messages on the screen for each thread, each thread waits its turn to display the message…
-
1
votes2
answers102
viewsHow does the pthread_cond_timedwait() function work?
The purpose of this function is to show the hours, wait for 2 seconds, and show the hours again to make sure that 2 seconds have passed. I am not using sleeps as this function is to help me…
-
1
votes1
answer36
viewsPthread_join not working as it should to popular a C array
I have the following code: #include <stdio.h> #include <pthread.h> #include <semaphore.h> #include <locale.h> #include <time.h> //declaração das variáveis globais float…
-
0
votes1
answer40
viewsHow to correctly receive an argument by creating a thread
I’m trying to create a thread to wait a while and then create a second thread using: pthread_create(&thread_intermedia, NULL, criar_thread, &init); where init is an integer, let’s say it is…
-
0
votes1
answer427
viewsPthreads, Buffer Consumer Producer Problem in C
The Goal of the program is to give in the command line nt=number of tasks that will be created , an integer n, and nbloco, number of interactions that each thread can have to calculate the sum of…
-
0
votes0
answers20
viewsWhat is the best way to synchronize these C threads?
Considering the following code, what is the best way to synchronize the threads that add the vectors with the threads that populate the vectors ? I have tried several ways, such as mutex and/or…
-
-1
votes1
answer61
viewsCode error repeating values in threads?
#include <pthread.h> #include <stdio.h> void *Operacao(void *soma) { int n; printf(“Digite o primeiro numero:”); scanf("%d", &n); printf(“Digite o segundo numero:”); scanf("%d",…
-
-1
votes1
answer94
viewsHow do I know if my threads are actually running at the same time?
The doubt arose in a college job where we need to make use of threads in c. We have been asked to study the "libpthread" so we can get on with the job. The material I’m finding in my research does…