- 论坛徽章:
- 0
|
谢谢大虾指点迷津,我把参数param在thr_fn转存了一下,问题解决了。
- void *thr_fn(void *arg)
- {
- int i;
- #ifdef ENABLE_PARM
- ThrParams_t stParam;
- memset(&stParam, 0x00, sizeof(ThrParams_t));
- memcpy(&stParam, (ThrParams_t*)arg, sizeof(ThrParams_t)); // Store the contents of parameter which is local variable in thread_gen().
- for(i = 0; i < stParam.iLogNum; i ++)
- {
- logging(LOG_INFOR, "[%s]pid=%u tid=%u loop=%d/%d\n", stParam.szThrName, getpid(), pthread_self(), i, stParam.iLogNum);
- }
- #else
- for(i = 0; i < MAX_COUNT_NUM; i ++)
- {
- logging(LOG_INFOR, "pid=%u tid=%u loop=%d\n", getpid(), pthread_self(), i);
- }
- #endif
- return ((void *)0);
- }
复制代码 |
|