RSS 2.0

Personal Info:

Joe Send mail to the author(s) leads the architecture of an experimental OS's developer platform, where he is also chief architect of its programming language. His current mission is to enable writing large-scale software that is reliable, secure, and scalable by-construction. Before this, Joe founded the Parallel Extensions to .NET project. He has been granted 19 patents, with 49 pending. When not working, Joe enjoys travelling with his wife, writing books, writing music, studying music theory & mathematics, and doing anything involving food & wine.

My books

My music

Disclaimer:
The content of this site are my own personal opinions and do not represent my employer's view in anyway.

© 2012, Joe Duffy

 
 Sunday, August 28, 2005

This is a fun example that illustrates a few topics I'm discussing at PDC in a couple weeks.

What, if anything, can cause Thread 2's assert below to fire?

class Foo {
    static Foo lastFoo;

    string state;
    bool initialized;

    public Foo() {
        state = "Developers, Developers, Developers!";
        initialized = true;
    }
}

// Thread #1:            // Thread #2:
lastFoo = new Foo();     Foo f = lastFoo;
                         Debug.Assert(f.initialized == true &&
                             f.state != null);

For purposes of illustration, imagine that lastFoo has already been initialized to some Foo prior to threads #1 and #2 executing.

8/28/2005 6:30:09 PM (Pacific Daylight Time, UTC-07:00)  #   

 

Recent Entries:

Search:

Browse by Date:
<August 2005>
SunMonTueWedThuFriSat
31123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Browse by Category:

Notables: