1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-28 01:00:52 -07:00

Amcssth test was broken: didn't register the worker threads as roots, only created one worker thread, registered it twice. weird.

Copied from Perforce
 Change: 182882
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Richard Brooksby 2013-07-01 20:04:30 +01:00
parent 7181701824
commit daebd8206a

View file

@ -298,14 +298,16 @@ static void *fooey(void* childIsFinishedReturn)
{
void *r;
mps_thr_t thread;
mps_thr_t thread2;
void *marker = ▮
mps_root_t reg_root;
/* register the thread twice, just to make sure it works */
die(mps_thread_reg(&thread, (mps_arena_t)arena), "thread_reg");
die(mps_thread_reg(&thread2, (mps_arena_t)arena), "thread2_reg");
die(mps_root_create_reg(&reg_root, arena, mps_rank_ambig(), 0, thread,
mps_stack_scan_ambig, marker, 0), "root_create");
mps_tramp(&r, fooey2, NULL, 0);
mps_root_destroy(reg_root);
mps_thread_dereg(thread);
mps_thread_dereg(thread2);
*(int *)childIsFinishedReturn = 1;
return r;
}
@ -314,9 +316,10 @@ static void *fooey(void* childIsFinishedReturn)
int main(int argc, char *argv[])
{
mps_thr_t thread;
mps_root_t reg_root;
/* mps_root_t reg_root; */
void *marker = ▮
pthread_t pthread1;
pthread_t kids[10];
unsigned i;
void *r;
int childIsFinished = 0;
@ -328,18 +331,23 @@ int main(int argc, char *argv[])
mps_message_type_enable(arena, mps_message_type_gc());
init();
die(mps_thread_reg(&thread, arena), "thread_reg");
die(mps_root_create_reg(&reg_root, arena, mps_rank_ambig(), 0, thread,
mps_stack_scan_ambig, marker, 0), "root_create");
pthread_create(&pthread1, NULL, fooey, (void *)&childIsFinished);
/* die(mps_root_create_reg(&reg_root, arena, mps_rank_ambig(), 0, thread,
mps_stack_scan_ambig, marker, 0), "root_create"); */
for (i = 0; i < sizeof(kids)/sizeof(kids[0]); ++i) {
int err = pthread_create(&kids[i], NULL, fooey, (void *)&childIsFinished);
if (err != 0)
error("pthread_create returned %d", err);
}
mps_tramp(&r, test, arena, 0);
mps_root_destroy(reg_root);
/* mps_root_destroy(reg_root); */
mps_thread_dereg(thread);
while (!childIsFinished) {
struct timespec req = {1, 0};
(void)nanosleep(&req, NULL);
for (i = 0; i < sizeof(kids)/sizeof(kids[0]); ++i) {
int err = pthread_join(kids[i], NULL);
if (err != 0)
error("pthread_join returned %d", err);
}
finish();
report(arena);
mps_arena_destroy(arena);