c++ - A Unique and Constant Identifier for a pthreads thread? -


I have estimated that a pthread_t remains constant for a given thread - its entirety For life, but my experiment is false to prove this assumption if the ID is not completely stable in a given yarn, how can I store a pthread_t so that the thread Can you use pthread_join to block until it ends?

For other reasons, it would be helpful to know how to get a unique identifier for a thread that I can change back and backward in pthread_t . Is there a way to do this?

There are a lot of big information, but I had a difficult time finding useful questions for answering these questions. I appreciate any help / consultation that I can get!

Edit: Also, I'm not sure why, but sleeping (1) and sleeping for 1 second on the front of each new thread (within the thread's function) . This is probably moving in the form of straw, but can the pthread_t value be fleeting during the beginning of a new thread or something ??

You can not trust a pthread_t , but you are unique To determine whether the two thread IDs are identical, use the pthread_equal () to use it.

  name pthread_equal - Compare thread id # include & lt; Pthread.h & gt; Int pthread_equal (pthread_t t1, pthread_t t2); The description pthread_equal () function compares thread IDs t1 and t2. Return value The pthread_equal () function returns non-zero if thread ID T1 and T2 match the same thread. Otherwise, this will return zero to  

Comments

Popular posts from this blog

c++ - Linux and clipboard -

What is expire header and how to achive them in ASP.NET and PHP? -

sql server - How can I determine which of my SQL 2005 statistics are unused? -