-
Type: Improvement
-
Resolution: Done
-
Priority: Trivial - P5
-
Affects Version/s: None
-
Component/s: Internal Client
-
None
we should improve OID() generation to be threadsafe. we can probably use boost interlockedincrement for this instead of inc++
when done be sure to add a comment in jsobj.h / struct OID that it is threadsafe now. also, same thing in the C driver?
void OID::init()
{ static unsigned machine = (unsigned) security.getNonce(); static unsigned inc = (unsigned) security.getNonce(); unsigned t = (unsigned) time(0); char *T = (char *) &t; data[0] = T[3]; data[1] = T[2]; data[2] = T[1]; data[3] = T[0]; (unsigned&) data[4] = machine; ++inc; T = (char *) &inc; char * raw = (char*)&b; raw[0] = T[3]; raw[1] = T[2]; raw[2] = T[1]; raw[3] = T[0]; }