我有这一法典:
#include <iostream>
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
using namespace std;
void* printHello (void* threadId){
cout << "in print Hello"<< (long) threadId << endl;
pthread_exit(NULL);
}
#define num 1000000
int main () {
pthread_t threads [num];
int rc;
long t;
for (t=0 ; t<num; ++t){
cout <<"in main" << "thread Id = " << t << endl;
rc = pthread_create(&threads[t] , NULL , printHello , (void*)t);
if (rc) {
cout << "ERROR"<< "rc= "<< rc << endl;
exit(-1);
}
}
pthread_exit(NULL);
}
How can I run from shell the ps -Lf, ps -T, ps -Lm
simultaneously to the code above?
I mean how can I run both in the shell command prompt? using another Tab doesn t seem to work properly.