Problem with rb_thread_create

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I have a small problem with rb_thread_create

first some example code:

========================================================================
static VALUE sSysServerThreadInit(MQ_PTR data)
{
MqSysServerThreadMain((struct MqSysServerThreadMainS*)data);
return rb_last_status_get();
}

static VALUE SysServerThreadCall (VALUE data) {
struct timeval sleep = {0, 200000};
VALUE ret = rb_thread_create(sSysServerThreadInit, VAL2PTR(data));
rb_thread_wait_for(sleep);
return ret;
}

the problem is that it is not guaranteed that “rb_thread_create” will
call the thread initialization code “sSysServerThreadInit”.
I need a sleep for at least “200000” usec after the “rb_thread_create”.
I think it is not good to have a fix waiting time because this is
system or processor dependent.

question:

why does the “rb_thread_create” not call the “sSysServerThreadInit”
proper?

thanks for help

mfg, Andreas O.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.15 (GNU/Linux)
Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJMudgHAAoJEGTcPijNG3/AoB4IAJc0gLb5ymM6DbAg/KXZaOH6
6TtITnodkd/bTSfLtN/s9giqjFa1YJhZqYZH7ot0XVx2KIZiJid5M6hIRm0NQ0Pe
YRypuQyWz89pQN583Y7SnQb0SkXf3y26ajZLVnxUp300/21F4oy+f7Csw0BabL4/
EAKSdqdcEDdlV/mP/LGgi7l7FprPsjDMVjvxTkQlGEKqdIxSrm0NH5yFoa2UINeP
GovwSOW3xHyTFN0JQkUcA+vlKiWSR/RrTnuoJlCcEvmzqc3Ru9OhWKRy10q36/Zf
KX15KNnXt/KXSfNDU2XGTLCHHfCuf8ZivmS8RMXUv28XENsdL5GQbWJvnOEFtXs=
=yGiN
-----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