From 2f7cc8c9e89474feb89d1c435d8dc9b43235cc1c Mon Sep 17 00:00:00 2001 From: Mark H Weaver Date: Sun, 1 Mar 2015 15:07:30 +0100 Subject: [PATCH] Issue 4304: Smob code changes mostly relevant for multithreading These changes have been suggested by Mark H Weaver in Signed-off-by: David Kastrup --- lily/include/smobs.hh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lily/include/smobs.hh b/lily/include/smobs.hh index a816b67ca3..3ee2ef80ab 100644 --- a/lily/include/smobs.hh +++ b/lily/include/smobs.hh @@ -266,21 +266,22 @@ public: } SCM unprotected_smobify_self () { - self_scm_ = Smob_base::register_ptr (static_cast (this)); - return self_scm_; + SCM s = Smob_base::register_ptr (static_cast (this)); + self_scm_ = s; + return s; } void protect () { protect_smob (self_scm_, &protection_cons_); } + void smobify_self () { + protect_smob (unprotected_smobify_self (), &protection_cons_); + } SCM unprotect () { - unprotect_smob (self_scm_, &protection_cons_); - return self_scm_; - } - void smobify_self () { - self_scm_ = unprotected_smobify_self (); - protect (); + SCM s = self_scm_; + unprotect_smob (s, &protection_cons_); + return s; } SCM self_scm () const { return self_scm_; } }; -- 2.39.5