30 # define CVC4_THREADLOCAL(__type...) __thread __type
31 # define CVC4_THREADLOCAL_PUBLIC(__type...) __thread CVC4_PUBLIC __type
32 # define CVC4_THREADLOCAL_TYPE(__type...) __type
35 # define CVC4_THREADLOCAL(__type...) ::CVC4::ThreadLocal< __type >
36 # define CVC4_THREADLOCAL_PUBLIC(__type...) CVC4_PUBLIC ::CVC4::ThreadLocal< __type >
37 # define CVC4_THREADLOCAL_TYPE(__type...) ::CVC4::ThreadLocal< __type >
41 template <
class T,
bool small>
42 class ThreadLocalImpl;
45 class ThreadLocalImpl<T, true> {
48 static void cleanup(
void*) {
53 pthread_key_create(&d_key, ThreadLocalImpl::cleanup);
56 ThreadLocalImpl(
const T& t) {
57 pthread_key_create(&d_key, ThreadLocalImpl::cleanup);
58 pthread_setspecific(d_key, const_cast<void*>(reinterpret_cast<const void*>(t)));
61 ThreadLocalImpl(
const ThreadLocalImpl& tl) {
62 pthread_key_create(&d_key, ThreadLocalImpl::cleanup);
63 pthread_setspecific(d_key, const_cast<void*>(reinterpret_cast<const void*>(static_cast<const T&>(tl))));
66 ThreadLocalImpl& operator=(
const T& t) {
67 pthread_setspecific(d_key, const_cast<void*>(reinterpret_cast<const void*>(t)));
70 ThreadLocalImpl& operator=(
const ThreadLocalImpl& tl) {
71 pthread_setspecific(d_key, const_cast<void*>(reinterpret_cast<const void*>(static_cast<const T&>(tl))));
76 return static_cast<T
>(
reinterpret_cast<size_t>(pthread_getspecific(d_key)));
81 class ThreadLocalImpl<T*,
true> {
84 static void cleanup(
void*) {
89 pthread_key_create(&d_key, ThreadLocalImpl::cleanup);
92 ThreadLocalImpl(
const T* t) {
93 pthread_key_create(&d_key, ThreadLocalImpl::cleanup);
94 pthread_setspecific(d_key, const_cast<void*>(reinterpret_cast<const void*>(t)));
97 ThreadLocalImpl(
const ThreadLocalImpl& tl) {
98 pthread_key_create(&d_key, ThreadLocalImpl::cleanup);
99 pthread_setspecific(d_key, const_cast<void*>(reinterpret_cast<const void*>(static_cast<const T*>(tl))));
102 ThreadLocalImpl& operator=(
const T* t) {
103 pthread_setspecific(d_key, const_cast<void*>(reinterpret_cast<const void*>(t)));
106 ThreadLocalImpl& operator=(
const ThreadLocalImpl& tl) {
107 pthread_setspecific(d_key, const_cast<void*>(reinterpret_cast<const void*>(static_cast<const T*>(tl))));
111 operator T*()
const {
112 return static_cast<T*
>(pthread_getspecific(d_key));
116 return *
static_cast<T*
>(pthread_getspecific(d_key));
119 return static_cast<T*
>(pthread_getspecific(d_key));
124 class ThreadLocalImpl<T, false> {
128 class ThreadLocal :
public ThreadLocalImpl<T, sizeof(T) <= sizeof(void*)> {
129 typedef ThreadLocalImpl<T, sizeof(T) <= sizeof(void*)> super;
132 ThreadLocal() : super() {}
133 ThreadLocal(const T& t) : super(t) {}
134 ThreadLocal(const ThreadLocal<T>& tl) : super(tl) {}
136 ThreadLocal<T>& operator=(const T& t) {
137 return static_cast< ThreadLocal<T>& >(super::operator=(t));
139 ThreadLocal<T>& operator=(const ThreadLocal<T>& tl) {
140 return static_cast< ThreadLocal<T>& >(super::operator=(tl));
145 class ThreadLocal<T*> : public ThreadLocalImpl<T*, sizeof(T*) <= sizeof(void*)> {
146 typedef ThreadLocalImpl<T*, sizeof(T*) <= sizeof(void*)> super;
149 ThreadLocal() : super() {}
150 ThreadLocal(T* t) : super(t) {}
151 ThreadLocal(const ThreadLocal<T*>& tl) : super(tl) {}
153 ThreadLocal<T*>& operator=(T* t) {
154 return static_cast< ThreadLocal<T*>& >(super::operator=(t));
156 ThreadLocal<T*>& operator=(const ThreadLocal<T*>& tl) {
157 return static_cast< ThreadLocal<T*>& >(super::operator=(tl));
161 return *static_cast<T*>(*this);
163 const T& operator*() const {
164 return *static_cast<const T*>(*this);
167 return static_cast<T*>(*this);
169 const T* operator->() const {
170 return static_cast<const T*>(*this);
This is CVC4 release version For build and installation please see the INSTALL file included with this distribution This first official release of CVC4 is the result of more than three years of efforts by researchers at New York University and The University of Iowa The project leaders are Clark please refer to the AUTHORS file in the source distribution CVC4 is a tool for determining the satisfiability of a first order formula modulo a first order CVC CVC3 but does not directly incorporate code from any previous version CVC4 is intended to be an open and extensible SMT engine It can be used as a stand alone tool or as a library It has been designed to increase the performance and reduce the memory overhead of its predecessors It is written entirely in C and is released under a free software see the INSTALL file that comes with this distribution We recommend that you visit our CVC4 tutorials online please write to the cvc users cs nyu edu mailing list *if you need to report a bug with CVC4
Macros that should be defined everywhere during the building of the libraries and driver binary...