We'll see how things evolve.Ģ You can find review for a particular post - if the review is already finished - from the post timeline. For example, if just one vote is missing you might consider posting there instead.ġ Other smaller coordination-tasks related to duplicate management, such as proposals for reversals of duplicate directions, could also happen here. In short, the system is the same as in the thread for reopening and undeleting.)Ī more low-key way to draw attention to a possible duplicate is this chat room, which has been created for similar purposes. (And if question is reopened again, this should be marked in the same place. This will help other users to see which request have already been resolved. After the question is closed, mark this clearly at the beginning of the post.If it turns out that discussion grows long and that it is contentious whether the particular question is indeed a duplicate, the question might deserve a separate post on meta.Or a brief explanation which of the two posts is more suitable as the duplicate target.) (Maybe short discussion why they are duplicates, if it is not clear that they are indeed duplicates. So your post should probably contain at least some brief explanation in addition to links to the duplicates. Keep in mind that very short answers are automatically turned into comments.In particular, you should have cast already a vote or flag, the question already has been through the close votes review queue, and it was still not marked as duplicate. Only use this thread if the usual means did not work.Do not use this thread for other types of closures, it is only for duplicates.1 The creation of this thread was decided here. The main use case are situations where a first attempt at duplicate closure was not successful. But that would not be pthread_t.This thread is intended to help with closure of duplicates. If you need a thread ID that has different semantics, there are lots of ways you can get one. The pthreads standard explicitly says you may not manipulate a thread ID in this way. The actual bytes of memory may contain extraneous bytes, indirect references, or anything else. A thread ID is just an opaque reference to a thread while that thread has not been joined or terminated and detached. It is literally impossible for a thread ID to be duplicated because the two thread IDs do not have any overlap in their lifetime and there is no meaningful value to the thread ID that persists beyond its lifetime. The only permitted way to compare pthread_ts for equality is with pthread_equal but the documentation says, " If either t1 or t2 are not valid thread IDs, the behavior is undefined." and since the thread has terminated and been joined, it's ID is no longer valid. You might think that you can do it by comparing the pthread_ts for equality rather than printing them. It is unreasonable to expect a meaningful value. So the standard doesn't even require this code to compile. The standard explicitly permits a pthread_t to be a struct. Who knows? The standard makes pthread_t an entirely opaque type with only a very limited set of defined operations. On your platform, pthread_t might behave like char * and this code might attempt to dereference it, but it may not point to any valid object. The behavior of this code is entirely undefined. The output routine could try to access bytes in the pthread_t that are not mapped into memory. You cannot assume it means anything at all. It may or may not include the entire value of the pthread_t. Nothing specifies what the printed value of a pthread_t should be. Your code has a bug: cout<<"threadcnt="<<i<<" "<<"thread_id=" << thread_id << endl There is no way bug free code could ever tell if a pthread_t is reused. Pthread_create( &thread_id, NULL, thread_function, NULL ) Ĭout<<"threadcnt="<<i<<" "<<"thread_id=" << thread_id << endl Īnd here is output trace and as you can see, there are duplicate thread IDs between loop 1 and loop 2 //Loop 1 Is this correct as i'm expecting all the thread IDs should be unique? I noticed there are duplicates of thread IDs not within the same loop, but between loops. I have a loop and each iteration of the loop will create 5 threads with pthread_create.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |