understanding Pthread_cond_signal()

Hi. I do not understand this function. It says in the reference manuals that it wakes up/unblocks blocked threads. Now what does this mean? Help me understand by the code below pls

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
extern "C" *void task1(*void x);
extern "C" *void task2(*void x);
declare mutex
declare cond

int main(){
  declare thread_a, thread_b;
  //
  //create thread_a and thread_b
  //join thread_a and thread_b
  //destroy cond
  
}

void* task1 ((int*)x){
      //send signal pthread_cond_signal(...)
     //lock mutex
     //wait
     //some code
      //unlock mutex

}

void* task2 ((int*)x){
      
     //lock mutex
     //wait
     //some code
     //unlock mutex
      //send signal pthread_cond_signal(...)
     
}

so signal is sending sinal to what exactly?

thanks
Last edited on
Here are good overviews of pthreads:

http://www.yolinux.com/TUTORIALS/LinuxTutorialPosixThreads.html

https://computing.llnl.gov/tutorials/pthreads/

Read the above sites and come back with any specific questions.
Last edited on
Topic archived. No new replies allowed.