CPU caching when multithreading behaviour
<p>Taking CPU caching and any possible compiler optimizations into account:</p>

<ol>
<li>Is it possible for "False" to be written to the console?</li>
<li>Is option 1 setting up a memory fence that guarantees the freshness of the object reference and the field?</li>
<li><p>Is option 2 less "safe" than option 1 in any way?</p>

<pre><code>class Program
{
    class Test
    {
        internal bool value = false;
    }

    static void Main(string[] args)
    {
        Test test = new Test();

        //Option 1
        ThreadPool.QueueUserWorkItem((s) =&gt; 
        {
            Thread.Sleep(1000);
            Console.WriteLine(((Test)s).value); 
        }, test);

        //Option 2
        ThreadPool.QueueUserWorkItem((s) =&gt;
        {
            Thread.Sleep(1000);
            Console.WriteLine(test.value);
        });

        test.value = true;
        Console.ReadLine();
    }
}
</code></pre></li>
</ol>
