-
Notifications
You must be signed in to change notification settings - Fork 3.1k
BUG likely:Create thread using libpthread failed in HHVM extesion #1007
Copy link
Copy link
Closed
Labels
Description
- i want create a thread in HHVM extension but failed.
code as follows:
59 int stacksize = 1048576;
60 int guardsize = 4096;
61
62 pthread_t thread1;
63 void *thread_result;
64 pthread_attr_t attr;
65 int res_init = pthread_attr_init(&attr);
66 int res_detach = pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED);
67 int res_sstack = pthread_attr_setstacksize(&attr, stacksize);
68 int res_sguard = pthread_attr_setguardsize(&attr, guardsize);
69 int res = pthread_create(&thread1, &attr, pfunc, NULL);
70 sleep(1);
71 pthread_join(thread1, &thread_result)
However, create failed and core dumped in pthread_create.
- we just to adjust pthread_attr_t attr,
if we set attr = NULL, work ok!!!!
if we set attr.stacksize=1MB, work failed!!!!!.
if we set attr.stacksize=2B, work ok!!!!
Is there anything different in HHVM to create a thread using libpthread?? this errors strongly confused me for 3 weeks. And we just read HHVM code involved MemoryManager and some functions involved Initing some params of thread, such as hphp_process_init(), init_thread_locals(), InitAllocatorThreadLocal(), init_stringdata_allocator(). But we couldnot fix this problem. is there anybody to give us some useful idea??
Thanks.
Reactions are currently unavailable