U
Urs Vogel
Hi
I'm using static, synchronized Hashtables:
static Hashtable _htDiags = new Hashtable();
static Hashtable htDiags = Hashtable.Synchronized(_htDiags);
I'm not totally sure, if this protection wrapper is sufficient in a
mutlithreaded Singleton:
if((pi = (ProcessInfo)htDiags[PID]) != null)
pi.MyFunc();
Do I have to additionally lock access to htDiags object, or is
'synchronized' access sufficient? Like this:
lock(htDiags)
{
if((pi = (ProcessInfo)htDiags[PID]) != null)
pi.MyFunc();
}
Thanks for any hints.
Urs
I'm using static, synchronized Hashtables:
static Hashtable _htDiags = new Hashtable();
static Hashtable htDiags = Hashtable.Synchronized(_htDiags);
I'm not totally sure, if this protection wrapper is sufficient in a
mutlithreaded Singleton:
if((pi = (ProcessInfo)htDiags[PID]) != null)
pi.MyFunc();
Do I have to additionally lock access to htDiags object, or is
'synchronized' access sufficient? Like this:
lock(htDiags)
{
if((pi = (ProcessInfo)htDiags[PID]) != null)
pi.MyFunc();
}
Thanks for any hints.
Urs