1

我已经编译了一个简单的 pthread_create 程序,并在 ARMv7 目标(cortex a9 CPU)上的 NetBSD5.1 中执行了相同的程序。

程序信号错误。相同的 pthread 程序正在另一台 PC 上运行,没有任何问题。

下面是示例程序

void *PrintHello(void *threadid){
    long tid, i;
    tid = (long)threadid;
    for (i=0; i<PRINT_REPEAT; i++) {
        printf("Hello World! It's me, thread #%ld!\n", tid); 
    };
    pthread_exit(NULL);
}

int main (int argc, char *argv[])
{
    pthread_t threads[NUM_THREADS];
    int rc;
    int t;
    printf("PrintHello is %p\r\n",(void *)PrintHello);
    for(t=0; t<NUM_THREADS; t++){
        rc = pthread_create(&threads[t], NULL, PrintHello, (void *)t);
    if (rc){
        printf("ERROR; return code from pthread_create() is %d\n", rc);
        }
       }
    pthread_exit(NULL);
}

对此的任何指示都会非常有帮助。我看到在执行程序时引发了 data_abort_handler 异常。

4

0 回答 0