[SERVER-435] OID generation in C++ driver should be threadsafe Created: 22/Nov/09  Updated: 12/Jul/16  Resolved: 02/Dec/09

Status: Closed
Project: Core Server
Component/s: Internal Client
Affects Version/s: None
Fix Version/s: 1.1.4

Type: Improvement Priority: Trivial - P5
Reporter: Dwight Merriman Assignee: Mathias Stearn
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Participants:

 Description   

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]; }

 Comments   
Comment by Mathias Stearn [ 01/Dec/09 ]

Will modify WrappingInt to also make MSGID atomic

Generated at Thu Feb 08 02:54:05 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.