localStaticLock - static local thread-safety

This commit is contained in:
Matej Sekoranja
2012-10-08 12:19:21 +02:00
parent 07f9a8c0f6
commit f88f0b4a76
5 changed files with 77 additions and 3 deletions

View File

@@ -528,10 +528,11 @@ FieldConstPtr FieldCreate::deserialize(ByteBuffer* buffer, DeserializableControl
FieldCreatePtr FieldCreate::getFieldCreate()
{
static FieldCreatePtr fieldCreate;
static Mutex mutex;
Lock xx(mutex);
LOCAL_STATIC_LOCK;
static FieldCreatePtr fieldCreate;
static Mutex mutex;
Lock xx(mutex);
if(fieldCreate.get()==0) fieldCreate = FieldCreatePtr(new FieldCreate());
return fieldCreate;
}