You would expect getopt() to be used only on the many thread since that
is the only thread that receives argc and argv.
So if it is only used in one thread there would only be a copy of the data? 
What if I spawn multiple threads and call getopt only on one?

It is hard to imagine how you could could call getopt() on any pthread created with pthread_create():  The thread has no argc and argv inputs so how could a pthread use getopt() unless you contrive something very artificial situation.  pthreads do not receive argument lists and, hence, don't need to parse argument lists.  The single thread that starts with main() is the only thread that has argc and argv and the only thread that can normally call getopt().


Reply via email to