lean4-htt/src/util/thread_script_state.h
Leonardo de Moura e3e1668f27 fix(util/thread_script_state): disable script_state recycling at finalization time
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2014-09-17 09:57:17 -07:00

43 lines
1.4 KiB
C++

/*
Copyright (c) 2014 Microsoft Corporation. All rights reserved.
Released under Apache 2.0 license as described in the file LICENSE.
Author: Leonardo de Moura
*/
#pragma once
#include "util/script_state.h"
namespace lean {
/**
\brief Execute the given piece of code in all global/system script_state objects.
\remark The code fragments are saved. If a thread needs to create a new
script_state object, all code blocks are executed.
\remark System code should be installed when Lean is started.
*/
void system_dostring(char const * code);
/**
\brief Import the given module in all global/system script_state objects.
\remark The module name is saved. If a thread needs to create a new
script_state object, all modules are imported.
*/
void system_import(char const * fname);
/**
\brief Retrieve a script_state object for the current thread.
The thread has exclusive access until the thread is destroyed,
or the method \c release_thread_script_state is invoked.
\remark For performance reasons global script_state objects
are recycled. So, users should not delete/redefine functions
defined using #system_dostring. So, side-effects are discouraged.
*/
script_state get_thread_script_state();
/**
\brief Put the thread script_state back on the state pool,
and available for other threads.
*/
void release_thread_script_state();
void enable_script_state_recycling(bool flag);
}