Menu

Threads

Help
2000-04-05
2000-04-05
  • Robert Dale

    Robert Dale - 2000-04-05

    I'm curious why there is no getThreadID() method?
    And, how can I manage threads without this?

     
    • Robert Dale

      Robert Dale - 2000-04-05

      Seems there is a getThread method but it was left undocumented.

       
      • David Sugar

        David Sugar - 2000-04-05

        In a typical CC++ threaded application, a thread is implimented within
        a "Run" method, and hence, it's "this" is essentially a pointer to the
        current thread.  The use of thread object pointers is both more generic (portable) and more useful in CC++ than the system thread
        Id.

        For objects that are not themselves a subclass of Thread, the getThread() function can be used to return the Thread object which
        represents the currently executing thread context.  This allows classes that can have methods invoked from multiple threads to identify who is executing.  However, as a practical consideration, I have not found direct need for it in the applications and classes I currently have written.

         

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.