Go to the source code of this file.
◆ ERROR_RETURN
◆ LOOPS
◆ SLEEP_VALUE
| #define SLEEP_VALUE 20000 |
◆ main()
| int main |
( |
int |
argc, |
|
|
char ** |
argv |
|
) |
| |
Definition at line 73 of file examples/locks_pthreads.c.
74{
77 int result_m, result_s,
rc,
i;
79
80
84
86 result_m = 2 * result_m -
i;
87 }
88 result_s = result_m;
89
92 }
93
95 {
96 printf("Library initialization error! \n");
97 exit(-1);
98 }
99
102
105
107 rc = pthread_create(&master, NULL,
Master, NULL);
111 }
112 rc = pthread_create(&slave1, NULL,
Slave, NULL);
116 }
117 pthread_join(master, NULL);
118 printf(
"Master: Expected: %d Recieved: %d\n", result_m,
count);
119 if (result_m !=
count)
122
123 pthread_join(slave1, NULL);
124 printf(
"Slave: Expected: %d Recieved: %d\n", result_s,
count);
125
126 if (result_s !=
count)
128
129 exit(0);
130}
initialize the PAPI library.
Lock one of two mutex variables defined in papi.h.
Set the current debug level for error output from PAPI.
Initialize thread support in the PAPI library.
Unlock one of the mutex variables defined in papi.h.
#define ERROR_RETURN(retval)
unsigned long int pthread_t
◆ Master()
| void * Master |
( |
void * |
arg | ) |
|
Definition at line 21 of file examples/locks_pthreads.c.
22{
24 int *pointer, * pointer2;
25
28
29
32
33
36
38
41
44 }
46
47
50
51
52 printf("Thread specific data is %d \n", *pointer2);
53
54 pthread_exit(NULL);
55}
Retrieve a pointer to a thread specific data structure.
Notify PAPI that a thread has 'appeared'.
Store a pointer to a thread specific data structure.
◆ Slave()
| void * Slave |
( |
void * |
arg | ) |
|
◆ count
◆ rank