yan bellavance
yan bellavance

Reputation: 4850

How do I know which thread called a method

I have a threadSafe method that gets called by multiple threads. Is there a way to know which thread called it?

Upvotes: 0

Views: 403

Answers (2)

Chris Dennett
Chris Dennett

Reputation: 22741

Well, you know the thread that calls the method, and by extension the same thread will be active inside that method call. You can just call QThread::currentThread() to get this.

Upvotes: 3

Samuel Carrijo
Samuel Carrijo

Reputation: 17949

If you need it, you could add a threadId parameter, and let it thread pass it to the method

Upvotes: 1

Related Questions