[CppAD] pthread_getunique_np
Stefan Vigerske
stefan at math.hu-berlin.de
Thu Aug 25 12:30:25 EDT 2011
Hi,
I think it is not everywhere available. At least it wasn't available on
my system too.
pthread_self() should give an identifier, even though it's not some int
between 0 and number-of-threads.
Stefan
> 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
>
> _______________________________________________
> CppAD mailing list
> CppAD at list.coin-or.org
> http://list.coin-or.org/mailman/listinfo/cppad
>
More information about the CppAD
mailing list