#include "virstring.h"
#include "cpu/cpu.h"
#include "virauth.h"
+#include "viratomic.h"
#define VIR_FROM_THIS VIR_FROM_TEST
struct _testDriver {
virMutex lock;
- int nextDomID;
virNodeInfo nodeInfo;
virInterfaceObjList ifaces;
bool transaction_running;
size_t numAuths;
testAuthPtr auths;
+ /* virAtomic access only */
+ volatile int nextDomID;
+
/* immutable pointer, immutable object after being initialized with
* testBuildCapabilities */
virCapsPtr caps;
!(ret->networks = virNetworkObjListNew()))
goto error;
- ret->nextDomID = 1;
+ virAtomicIntSet(&ret->nextDomID, 1);
return ret;
goto cleanup;
virDomainObjSetState(dom, VIR_DOMAIN_RUNNING, reason);
- dom->def->id = privconn->nextDomID++;
+ dom->def->id = virAtomicIntAdd(&privconn->nextDomID, 1);
if (virDomainObjSetDefTransient(privconn->caps,
privconn->xmlopt,