This project has moved and is read-only. For the latest updates, please go here.
4

Closed

race condition in Messenger.Default

description

in multi-threaded environment Messenger.Default may create more then one different instance if thread switch happens between check and assign _defaultInstance. possible solution (in Messenger.cs):

private static Messenger _defaultInstance;
public static Messenger Default { get { return _defaultInstance ?? (_defaultInstance = new Messenger()); } }

=>

private static Lazy<Messenger> _defaultInstance = new Lazy<Messenger> ();
public static Messenger Default { get { return _defaultInstance.Value; } }
Closed Oct 13, 2014 at 1:54 PM by lbugnion

comments

lbugnion wrote Sep 11, 2011 at 11:09 PM

Fixed in V4 beta 1