Thread: Thread

    #1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0

    Thread [solved]


    Hi everybody,

    I would like to know if a procedure or function is been executed in a thread different from the main thread, or to get some thread id that I can compare and know this information.

    Do any one have a clue how to do that?

    thanks
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    May 2012
    Posts
    151
    Rep Power
    3
    In Windows environment you can use Windows API GetCurrentThreadId. It returns the id of the thread that the call was done in. If you store the main thread id somewhere, you can use the result of GetCurrentThreadId and compare it to the stored main thread id.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2012
    Posts
    6
    Rep Power
    0
    Thanks a lot Luthfi, your suggestion works well.

IMN logo majestic logo threadwatch logo seochat tools logo