mirror of
				https://github.com/Z3Prover/z3
				synced 2025-10-31 03:32:28 +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:
		
							parent
							
								
									ad16cc0ce2
								
							
						
					
					
						commit
						9b3e242990
					
				
					 26 changed files with 165 additions and 14 deletions
				
			
		
							
								
								
									
										47
									
								
								src/util/rlimit.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										47
									
								
								src/util/rlimit.h
									
										
									
									
									
										Normal 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 | ||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue