我正在尝试在 Tilera 平台上使用 pthreads 开发一个并行程序。该程序编译没有问题,但是当我运行它时出现错误:
pthread_create.c:389: start_thread: Assertion `freesize < pd->stackblock_size' failed.
这是什么意思,我该如何解决?
程序的逐步执行表明,当线程试图调用'pthread_exit(NULL);'
. 有什么建议吗?
线程源代码如下:
void *Consumer(void *threadargs){
// Initialize structure
rtP_Consumer_Controll rtp_lfe;
Init_Consumer(&rtp_lfe);
// Receiving the set of CPUs and thread id
thread_data *th_data = (thread_data *) threadargs;
int th_id = th_data->thread_id;
// Binding this thread to a CPU
if (tmc_cpus_set_my_cpu(th_id) < 0)
tmc_task_die("THREAD Consumer: 'tmc_cpus_set_my_cpu' has failed");
// Activating network communication
if (tmc_udn_activate() < 0)
tmc_task_die("THREAD Consumer: Failure in ’tmc_udn_activate()’.");
// Declaring necessary vars
FOP_data r_data;
real_T result;
// Loop over receiving, processing and sending
while (!terminate)
{
if (tmc_udn0_available_count() == 0) continue;
// Receiving data to process
tmc_udn0_receive_buffer((FOP_data*)&r_data,sizeof(r_data));
// Computing a function
Consumer_Func(r_data.pA,r_data.pB,&rtp_lfe,&result);
printf("THREAD Consumer: result %lf ... \n",result);
}
printf("THREAD Consumer: Finalizing the thread ... \n");
// Exiting the thread
pthread_exit(NULL);
}
Terminate 是主线程修改的全局变量。
ulimit -a 的执行提供了以下输出:
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 8022
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1024
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 8022
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited