[concurrency-interest] Starting a Thread within a constructor, what can go wrong?

David Holmes davidcholmes at aapt.net.au
Sat Dec 11 00:43:26 EST 2010

I assume there's some initialization code missing from the Cache class as
the code as shown is safe.

David Holmes
  -----Original Message-----
  From: concurrency-interest-bounces at cs.oswego.edu
[mailto:concurrency-interest-bounces at cs.oswego.edu]On Behalf Of Alex Miller
  Sent: Saturday, 11 December 2010 3:04 PM
  To: concurrency-interest at cs.oswego.edu
  Subject: Re: [concurrency-interest] Starting a Thread within a
constructor,what can go wrong?

  I've got a couple examples of this in this presentation:


  on slides 39-40.  The cache background cleaner example on slide 40 is
based on some actual bad code that I wrote that did sometimes throw NPEs
when the background thread saw partially constructed class state.  I'm sure
with some timing nudges or enough reps that you could coax it into regular

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cs.oswego.edu/pipermail/concurrency-interest/attachments/20101211/962fafcb/attachment.html>

More information about the Concurrency-interest mailing list