Problem with rb_thread_create

A

Andreas Otto

-----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 Otto
-----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-----
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,994
Messages
2,570,223
Members
46,812
Latest member
GracielaWa

Latest Threads

Top