1 /* See what the implementation returns for TSD keys */
2 
3 #include	"unpthread.h"
4 
5 pthread_key_t	my_key;
6 
7 int
main(int argc,char ** argv)8 main(int argc, char **argv)
9 {
10 	int		*iptr;
11 
12 	Pthread_key_create(&my_key, NULL);
13 	printf("first key = %d\n", my_key);
14 
15 	Pthread_key_create(&my_key, NULL);
16 	printf("second key = %d\n", my_key);
17 
18 	Pthread_key_create(&my_key, NULL);
19 	printf("third key = %d\n", my_key);
20 
21 	if ( (iptr = pthread_getspecific((pthread_key_t) 0)) == NULL)
22 		printf("key 0 pointer is NULL\n");
23 	else
24 		printf("value in key 0 = %d\n", *iptr);
25 
26 	errno = 67;
27 	if ( (iptr = pthread_getspecific((pthread_key_t) 0)) == NULL)
28 		printf("key 0 pointer is NULL\n");
29 	else
30 		printf("value in key 0 = %d\n", *iptr);
31 
32 	exit(0);
33 }
34