[CppAD] pthread_getunique_np

Brad Bell bradbell at seanet.com
Thu Aug 25 12:11:04 EDT 2011


Should the function
     #include <pthread.h>
     int pthread_getunique_np(pthread_t thread, pthread_id_np_t *id);
be defined for all posix thread systems ?

It is described at
     
http://cursuri.cs.pub.ro/~apc/2003/resources/pthreads/uguide/users-23.htm

On the other hand, it is not present in
     http://pubs.opengroup.org/onlinepubs/009695399/basedefs/pthread.h.html

If I run the the bash script included below, I get the response
$ ./pthread_id.sh
g++ -g pthread_id.cpp -o pthread_id
pthread_id.cpp: In function `int main(int, char**)':
pthread_id.cpp:6: error: `pthread_id_np_t' was not declared in this scope
pthread_id.cpp:6: error: expected `;' before `tid'
pthread_id.cpp:7: error: `tid' was not declared in this scope
pthread_id.cpp:7: error: `pthread_getthreadid_np' was not declared in 
this scope

----------------------------------------------
#! /bin/bash -e
#
cat << EOF > pthread_id.cpp
# include <pthread.h>
# include <cstdlib>

int main (int argc, char *argv[])
{
      pthread_id_np_t   tid;
      tid = pthread_getthreadid_np();

      exit(0);
}
EOF
echo "g++ -g pthread_id.cpp -o pthread_id"
g++ -g pthread_id.cpp -o pthread_id
#
echo "./pthread_id"
./pthread_id



More information about the CppAD mailing list