John Elliot writes:

> I guess I meant 'strange' as in 'closed source, poorly
> documented, "I didn't write it", etc.' (don't know much
> about DirectX doco, so that's not a sledge as such).

The DirectX docs are actually fairly decent.

> Say for example I'm targeting the managed DirectX API, and my
> client code is multithreaded, and I do something horrible,
> passing structs allocated on my stack by ref to a 'helper'
> method that dereferences them and passes them by value to
> the underlying API for execution on another thread. I'd still
> be safe, because the dereferencing happened on my thread,
> however if I passed them by ref to the other thread, then
> by the time the second thread is executing my original
> thread has changed state, and literally anything might be
> on the stack.

This can't happen.  There is no way to retain a reference to a argument that
is a pass-by-reference value type.  No way at all.

The worst that can happen is that two threads are banging on the same
structure at the same time.  No big deal -- it's just an application
semantics bug.

You most certainly CANNOT smash the stack (or read stack noise) using
*verifiable* (safe) MSIL code.  (According to the design, that is -- there
may well be bugs that allow it, but bugs are by definition exceptions.)

-- arlie

===================================
This list is hosted by DevelopMentorŪ  http://www.develop.com
Some .NET courses you may be interested in:

NEW! Guerrilla ASP.NET, 17 May 2004, in Los Angeles
http://www.develop.com/courses/gaspdotnetls

View archives and manage your subscription(s) at http://discuss.develop.com

Reply via email to