公告:非计时区代码不允许增,删,改
-
typedef struct { int a, b; } test_param; //... test_param t; t.a = 1; t.b = 2; athread_spawn(func, &t)
typedef struct { int a, b; } test_param; void func(test_param *t){ printf("%d %d\n", t->a, t->b); }
试一哈...
-
//common_def.h struct athread_spawn_param { int iter; //ptr on mpe double* ptr0, *ptr1, ......; }; //master.c #include "common_def.h" ...... int mian() { ......//定义了各种ptr struct athread_spawn_param init_param; init_param.my_rank = iter; init_param.ptr0 = ptr0; init_param.ptr1 = ptr1; ...... athread_spawn(func, (void*)¶m); ...... } //slave.c #include "common_def.h" __thread_local struct athread_spawn_param param; ...... void func(void *_param) { param = *((struct athread_spawn_param *) _param); //然后就可以愉快地使用param.ptr*了 }
-
@虚渺
int mian
23333
-
@虚渺 请问主核里面的那句athread_spawn(func, (void*)¶m);
是不是athread_spawn(func, (void*)&init_param);?
-
@嘴神爱6 是的,看来是我之前打错了