C++ pthreads进程未显示在ps输出中

C++ pthreads进程未显示在ps输出中,c++,pthreads,C++,Pthreads,我试图使用pthreads创建两个新进程,每个进程都使用一个文件描述符从管道中读取或写入 我有一个主函数,它会自动分叉并使用execl()执行pthread creator。从那里,我运行pthreads来创建两个进程,每个进程都有一个不同的管道末端。然后我等待线程完成,然后继续做其他事情 这是我的密码: int createThreads(int fds[]) { int retcd = OK; /* return code */ pthread_t talk1, talk2

我试图使用pthreads创建两个新进程,每个进程都使用一个文件描述符从管道中读取或写入

我有一个主函数,它会自动分叉并使用
execl()
执行pthread creator。从那里,我运行pthreads来创建两个进程,每个进程都有一个不同的管道末端。然后我等待线程完成,然后继续做其他事情

这是我的密码:

int createThreads(int fds[])
{
    int retcd = OK;  /* return code */
    pthread_t talk1, talk2;
    int ret1, ret2;

    // Create both talk agent processes
    ret1 = pthread_create(&talk1, NULL, talk, &fds[0]); // read
    ret2 = pthread_create(&talk2, NULL, talk, &fds[1]); // write

    // Wait for both processes to finish at the same time
    pthread_join(talk1, NULL);
    pthread_join(talk2, NULL);

    return(retcd);
}

talk函数接受文件描述符并对其执行一些操作。问题是,当我运行
ps-fu[username]
时,我似乎看不到两个pthreads进程的生成。语法有问题吗?

pthread\u create
不创建新进程-它在同一进程中创建新线程。 如果你想在ps中看到线程,你需要使用H选项,比如
psh-fu[username]