Asked By Chris Mullins [MVP]
25-Apr-07 01:51 PM

From time-slice to time-slice, the O/S can move the thread between
processors. You need to explicitly set processor affinity to prevent that.
Not really. You need to call out to Win32.
The link I sent you, to a Joe Duffy blog entry, shows an example of that
being done.
The right answer is to not abort the thread. This will cause you all sorts
of headaches and will never, ever, work perfectly. It's always going to be
prone to bugs. You need a better signaling mechanism.
That won't really do it either, and is much more complex than it initially
sounds. Reading and Writing to Volatile variables still needs locks to
insure you don't get read/write tears. There are alot of subtle behaviors
around volatile variables that are best avoided.
If you really need to go down this route, use the various Interlocked
methods, not a volatile variable.
--
Chris Mullins, MCSD.NET, MCPD:Enterprise, Microsoft C# MVP
http://www.coversant.com/blogs/cmullins