jgauffin
jgauffin

Reputation: 101166

Compare CurrentThread from ProcessThread.Id

How can I check if CurrentThread is the one specified by ProcessThread.Id?

Upvotes: 1

Views: 116

Answers (1)

Hans Passant
Hans Passant

Reputation: 942030

.NET stops you from assuming that a Thread is actually an operating system thread. It is on any shipping version of the CLR but that was not originally the plan. A project in the SQL Server team to implement Thread on top of a fiber failed. You'll have to pinvoke GetCurrentThreadId(). Visit pinvoke.net for the declaration.

Upvotes: 3

Related Questions