Hi all,
I developpe an extension php, and I would like use Linux pthread in my
extension (PHP 5.6.27).
But I have a feeling that my thread don't work, I looked for the
documentation but I find no concrete example.
Can I use pthread without zts activated ? Sample of my code :
void *called_from_thread(void *num){
php_printf(" print by thread");
}
PHP_FUNCTION(test){
pthread_t inc_x_thread;
int x = 0;
if(pthread_create(&inc_x_thread, NULL, called_from_thread, &x)) {
php_printf("Error creating thread");
return;
}
php_printf("This is main print");
if(pthread_join(inc_x_thread, NULL)) {
php_printf("Error joining thread");
return;
}
}
When I execute my extension in php, I always obtain the same display, This
is main print print by thread
For me the normal behavior of thread would be to have different displays
sometimes... no ?
Every help/advice is welcome :)
Regards.
Simon