From a26d628e5cd316467bb2a48ff211e1858a66f99e Mon Sep 17 00:00:00 2001 From: Jason Turner Date: Wed, 27 Nov 2013 08:19:26 -0700 Subject: [PATCH] Cleanup (indentation, comments) for non-const global support @Zoomulator - I pulled in your non-const global commits. --- include/chaiscript/dispatchkit/dispatchkit.hpp | 5 ++++- include/chaiscript/language/chaiscript_engine.hpp | 7 ++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/include/chaiscript/dispatchkit/dispatchkit.hpp b/include/chaiscript/dispatchkit/dispatchkit.hpp index 17ae38e..72c73ca 100644 --- a/include/chaiscript/dispatchkit/dispatchkit.hpp +++ b/include/chaiscript/dispatchkit/dispatchkit.hpp @@ -478,7 +478,10 @@ namespace chaiscript } - void add_global(const Boxed_Value &obj, const std::string &name) + /** + * Adds a new global (non-const) shared object, between all the threads + */ + void add_global(const Boxed_Value &obj, const std::string &name) { validate_object_name(name); diff --git a/include/chaiscript/language/chaiscript_engine.hpp b/include/chaiscript/language/chaiscript_engine.hpp index a241163..4cf268c 100644 --- a/include/chaiscript/language/chaiscript_engine.hpp +++ b/include/chaiscript/language/chaiscript_engine.hpp @@ -454,7 +454,12 @@ namespace chaiscript return *this; } - ChaiScript &add_global(const Boxed_Value &t_bv, const std::string &t_name) + /// \brief Adds a mutable object that is available in all contexts and to all threads + /// \param[in] t_bv Boxed_Value to add as a global + /// \param[in] t_name Name of the value to add + /// \warning The user is responsible for making sure the object is thread-safe if necessary + /// ChaiScript is thread-safe but provides no threading locking mechanism to the script + ChaiScript &add_global(const Boxed_Value &t_bv, const std::string &t_name) { m_engine.add_global(t_bv, t_name); return *this;