Simple thread in MINGW32 c extension cannot be joined

Hallo List,

I’m currently trying to build a cross platform C++ Ruby Extension
module.

All works with Linux, but when trying to build under MINGW32 for Windows
I have the problem that I cannot join a std::thread that was created in
my extension module earlier.

The extension module code is fairly simple (stripped down to show the
problem isolated):

class SayHello
{
public:
void operator()() const {
std::cout<< “hello” << std::endl;
}
};

VALUE method_test1(VALUE self) {
std::thread t((SayHello()));
t.join();
return rb_str_new2(“success”);
}

void Init_test() {
mTest = rb_define_class(“Test”, rb_cObject);
rb_define_method(mTest, “test1”, (VALUE (*)(…)) method_test1, 0);
}

Environment is: Windows 7, 32bit, Ruby 1.9.3-p545 (download from
rubyinstaller.org), MingW i686-4.8.3-release-posix-sjlj-rt_v3-rev0
(download from MingW-w64 project), MSYS2

The thread starts up and finishes, but the join is blocking
indefinitely.

Please let me know what further information you might need to maybe help
me nailing down the problem.

Is there some interaction with the thread magic that ruby itself does in
thread_win32.c? Are there any symbols / functions exported from the ruby
dll or interpreter that might interfere with my usage in the extension
module?

My thread here is completely independant and doesn’t need any
interaction
with ruby itself.

Thanks

Tino

KINDLY UN SUBSCRIBE ME

On Fri, May 30, 2014 at 6:33 PM, Tino Lange
[email protected]

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA512

To unsubscribe, send an email with the subject ‘unsubscribe’ (no
quotes) to [email protected] Follow instructions
throughout the process.

On 5/31/2014 03:26, Vishal Bisht wrote:

module.

rubyinstaller.org http://rubyinstaller.org), MingW
does in thread_win32.c? Are there any symbols / functions exported


Rylee F.
[email protected]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.22 (MingW32)
Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/

iQEcBAEBCgAGBQJTi71GAAoJEAWmNCH2N+MzYPQIAJoxYzWLam7Fz4BvHVnnHeNv
jmhdQg3bXJ0G9G6z3CSIONaIDpSmU4R7zSMXk/uPavGHASIjr4N6RS4h0UYrGNLa
WIthKCGbQPEEbeAKwkQW6M2awca+FcjJcgF9FBldF/w0bQNAec4gDx8fstBJ+Q6w
Y20i4BDkVanA637YD7rEnmtRkn8xc6fmTs093wsZpdBa3bJLwsAdxFzufawHRH5z
zVHy9GpU/QjoKHl2+89ODz1FPRNU68fNq/lprNEvVWighjjpPpWm2B3zA9GaPOZ5
+kbXgW+w2iS0lb85pNhLUGfDCNnMA4RJY/EOoGd4YmopEKKlKGtTwXkSi7b1N/E=
=T+Uv
-----END PGP SIGNATURE-----

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs