Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ MT-multithreading and servers » Thread::GetId() returning 0
Re: Thread::GetId() returning 0 [message #50170 is a reply to message #50151] Fri, 10 August 2018 20:52 Go to previous messageGo to previous message
mirek is currently offline  mirek
Messages: 13975
Registered: November 2005
Ultimate Member
mdelfede wrote on Wed, 08 August 2018 14:29
Partial reply to myself... I used Start instead of Run, and the thread was detached from variable.
But now, I'm using Thread::GetCurrentId() which should return the Id of calling thread, but returns instead a very big number which has probably nothing to do with it.


OS? Anyway the implementation is really straightforward, so I do not think there should be a bug there...

Quote:

How can I check if I'm inside a required thread ? (same as IsMainThread, but something like myThread.Inside())


What about storing the thread id into thread_local variable at the start of the thread and then test if your GetCurrentId is the same?


Mirek
 
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: Feature request - GetPeerAddr in WebSocket
Next Topic: [SOLVED] Discord bot 404 error using WebSocket, any ideas?
Goto Forum:
  


Current Time: Sat Apr 20 08:26:24 CEST 2024

Total time taken to generate the page: 0.04250 seconds