3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-08-11 21:50:52 +00:00

adding rlimit resource limit facility to provide platform and architecture independent method for canceling activities

Signed-off-by: Nikolaj Bjorner <nbjorner@microsoft.com>
This commit is contained in:
Nikolaj Bjorner 2015-09-28 13:37:59 -07:00
parent ad16cc0ce2
commit 9b3e242990
26 changed files with 165 additions and 14 deletions

47
src/util/rlimit.h Normal file
View file

@ -0,0 +1,47 @@
/*++
Copyright (c) 2015 Microsoft Corporation
Module Name:
rlimit.h
Abstract:
Resource limit container.
Author:
Nikolaj Bjorner (nbjorner) 2015-09-28
Revision History:
--*/
#ifndef RLIMIT_H_
#define RLIMIT_H_
#include "vector.h"
class reslimit {
unsigned m_count;
unsigned m_limit;
unsigned_vector m_limits;
public:
reslimit();
bool inc();
bool inc(unsigned offset);
void push(unsigned delta_limit);
void pop();
unsigned count() const;
};
class scoped_rlimit {
reslimit& m_limit;
public:
scoped_rlimit(reslimit& r, unsigned l): m_limit(r) {
r.push(l);
}
~scoped_rlimit() { m_limit.pop(); }
};
#endif