From: Matthew Kerwin Date: 2012-11-21T15:46:05+09:00 Subject: Re: "undefined method `synchronize' for #" from embedded Ruby program --e89a8ff1ca525257d104cefbb404 Content-Type: text/plain; charset=ISO-8859-1 Is this thread related? http://www.ruby-forum.com/topic/217934 On 21 November 2012 16:38, Graham Menhennitt wrote: > I'm writing a C++ program (on Centos 5 Linux) that embeds a Ruby 1.9.3 > p327 interpreter. It mostly works, but I'm getting a strange error from > a script called by the program. When run from the command line (i.e. not > embedded), the script works correctly. The error is: > undefined method `synchronize' for # > If I search back over this list's archives, I can see a few other people > with the same problem (but no solution). > > I've narrowed it down to the following test program: > > #include > > int > main(int argc, char *argv[]) > { > RUBY_INIT_STACK; > ruby_init(); > ruby_init_loadpath(); > > rb_eval_string("$mutex = Mutex.new"); > rb_eval_string("$mutex.synchronize(){}"); > > return 0; > } > > Does anybody have any clues, please? > > Thanks, Graham > > -- Matthew Kerwin, B.Sc (CompSci) (Hons) http://matthew.kerwin.net.au/ ABN: 59-013-727-651 "You'll never find a programming language that frees you from the burden of clarifying your ideas." - xkcd --e89a8ff1ca525257d104cefbb404 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Is this thread related?



On 21 November 20= 12 16:38, Graham Menhennitt <graham@menhennitt.com.au> wrote:
I'm writing a C++ program (on Centos 5 L= inux) that embeds a Ruby 1.9.3
p327 interpreter. It mostly works, but I'm getting a strange error from=
a script called by the program. When run from the command line (i.e. not embedded), the script works correctly. The error is:
=A0 =A0 undefined method `synchronize' for #<Mutex:0xa0f5adc>
If I search back over this list's archives, I can see a few other peopl= e
with the same problem (but no solution).

I've narrowed it down to the following test program:

#include <ruby.h>

int
main(int argc, char *argv[])
{
=A0 =A0 RUBY_INIT_STACK;
=A0 =A0 ruby_init();
=A0 =A0 ruby_init_loadpath();

=A0 =A0 rb_eval_string("$mutex =3D Mutex.new");
=A0 =A0 rb_eval_string("$mutex.synchronize(){}");

=A0 =A0 return 0;
}

Does anybody have any clues, please?

Thanks, Graham




--
=A0 Matthew = Kerwin, B.Sc (CompSci) (Hons)
=A0 http://matthew.kerwin.net.au/
=A0 ABN: 59-013-= 727-651

=A0 "You'll never find a programming language that frees
= =A0 you from the burden of clarifying your ideas." - xkcd
--e89a8ff1ca525257d104cefbb404--