mirror of
https://github.com/Z3Prover/z3
synced 2025-05-09 00:35:47 +00:00
Z3 sources
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
This commit is contained in:
parent
3f9edad676
commit
e9eab22e5c
1186 changed files with 381859 additions and 0 deletions
45
lib/critical_flet.h
Normal file
45
lib/critical_flet.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*++
|
||||
Copyright (c) 2011 Microsoft Corporation
|
||||
|
||||
Module Name:
|
||||
|
||||
critical flet.cpp
|
||||
|
||||
Abstract:
|
||||
|
||||
Version of flet using "omp critical" directive.
|
||||
|
||||
Warning: it uses omp critical section "critical_flet"
|
||||
|
||||
Author:
|
||||
|
||||
Leonardo de Moura (leonardo) 2011-05-12
|
||||
|
||||
Revision History:
|
||||
|
||||
--*/
|
||||
#ifndef _CRITICAL_FLET_H_
|
||||
#define _CRITICAL_FLET_H_
|
||||
|
||||
template<typename T>
|
||||
class critical_flet {
|
||||
T & m_ref;
|
||||
T m_old_value;
|
||||
public:
|
||||
critical_flet(T & ref, const T & new_value):
|
||||
m_ref(ref),
|
||||
m_old_value(ref) {
|
||||
#pragma omp critical (critical_flet)
|
||||
{
|
||||
m_ref = new_value;
|
||||
}
|
||||
}
|
||||
~critical_flet() {
|
||||
#pragma omp critical (critical_flet)
|
||||
{
|
||||
m_ref = m_old_value;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
Loading…
Add table
Add a link
Reference in a new issue