mirror of
https://github.com/Z3Prover/z3
synced 2025-04-23 17:15:31 +00:00
replace remaining volatiles with atomic<>
volatiles are now deprecated in recent C++
This commit is contained in:
parent
a4aa87b6c9
commit
0213af3c61
7 changed files with 19 additions and 11 deletions
|
@ -21,11 +21,12 @@ Revision History:
|
|||
#include<unistd.h>
|
||||
#endif
|
||||
#include<iostream>
|
||||
#include "util/mutex.h"
|
||||
#include "util/str_hashtable.h"
|
||||
#include "util/z3_exception.h"
|
||||
#include "util/z3_version.h"
|
||||
|
||||
static volatile bool g_enable_assertions = true;
|
||||
static atomic<bool> g_enable_assertions(true);
|
||||
|
||||
void enable_assertions(bool f) {
|
||||
g_enable_assertions = f;
|
||||
|
|
|
@ -19,6 +19,7 @@ Revision History:
|
|||
#pragma once
|
||||
|
||||
#include "util/vector.h"
|
||||
#include <atomic>
|
||||
|
||||
void initialize_rlimit();
|
||||
void finalize_rlimit();
|
||||
|
@ -28,7 +29,7 @@ void finalize_rlimit();
|
|||
*/
|
||||
|
||||
class reslimit {
|
||||
volatile unsigned m_cancel;
|
||||
std::atomic<unsigned> m_cancel;
|
||||
bool m_suspend;
|
||||
uint64_t m_count;
|
||||
uint64_t m_limit;
|
||||
|
|
|
@ -133,8 +133,13 @@ public:
|
|||
}
|
||||
|
||||
vector(SZ s) {
|
||||
m_data = nullptr;
|
||||
init(s);
|
||||
}
|
||||
|
||||
void init(SZ s) {
|
||||
SASSERT(m_data == nullptr;);
|
||||
if (s == 0) {
|
||||
m_data = nullptr;
|
||||
return;
|
||||
}
|
||||
SZ * mem = reinterpret_cast<SZ*>(memory::allocate(sizeof(T) * s + sizeof(SZ) * 2));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue