[macruby-changes] [4491] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Thu Sep 2 18:35:24 PDT 2010
Revision: 4491
http://trac.macosforge.org/projects/ruby/changeset/4491
Author: lsansonetti at apple.com
Date: 2010-09-02 18:35:21 -0700 (Thu, 02 Sep 2010)
Log Message:
-----------
lock up some impure functions to avoid race conditions
Modified Paths:
--------------
MacRuby/trunk/bridgesupport.cpp
MacRuby/trunk/vm.cpp
Modified: MacRuby/trunk/bridgesupport.cpp
===================================================================
--- MacRuby/trunk/bridgesupport.cpp 2010-09-03 01:10:20 UTC (rev 4490)
+++ MacRuby/trunk/bridgesupport.cpp 2010-09-03 01:35:21 UTC (rev 4491)
@@ -391,8 +391,10 @@
{
// Generate the real #new method.
rb_vm_bs_boxed_t *bs_boxed = locate_bs_boxed(rcv, true);
+ GET_CORE()->lock();
Function *f = RoxorCompiler::shared->compile_bs_struct_new(bs_boxed);
IMP imp = GET_CORE()->compile(f);
+ GET_CORE()->unlock();
// Replace the fake method with the new one in the runtime.
rb_objc_define_method(*(VALUE *)rcv, "new", (void *)imp, -1);
@@ -425,9 +427,11 @@
assert(field != -1);
// Generate the new setter method.
+ GET_CORE()->lock();
Function *f = RoxorCompiler::shared->compile_bs_struct_writer(
bs_boxed, field);
IMP imp = GET_CORE()->compile(f);
+ GET_CORE()->unlock();
// Replace the fake method with the new one in the runtime.
buf[s - 1] = '=';
Modified: MacRuby/trunk/vm.cpp
===================================================================
--- MacRuby/trunk/vm.cpp 2010-09-03 01:10:20 UTC (rev 4490)
+++ MacRuby/trunk/vm.cpp 2010-09-03 01:35:21 UTC (rev 4491)
@@ -2875,6 +2875,8 @@
void *
RoxorCore::gen_to_rval_convertor(std::string type)
{
+ RoxorCoreLock lock;
+
std::map<std::string, void *>::iterator iter =
to_rval_convertors.find(type);
if (iter != to_rval_convertors.end()) {
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20100902/186c1fff/attachment.html>
More information about the macruby-changes
mailing list