void MainWindow::slotSetSettings( const QString &portName, const QString &portSpeed ) { delete m_receiver; QSerialPort::BaudRate convertedPortSpeed = static_cast<QSerialPort::BaudRate>( portSpeed.toInt() ); m_receiver = new Receiver( portName, convertedPortSpeed ); runReceiver(); }
int main() { int pid_sender; // id of sender process int pid_receiver; // id of receiver process int RWpipe[2]; // initialize pipe int array pipe(RWpipe); // create pipe with array // fire sender with pipe if(pid_sender = fork() == 0) { /* child process */ runSender(RWpipe); } else if(pid_sender < 0) { printf("Error: could not fork sender"); exit(1); // exit with code 1 } // fire receiver with pipe if(pid_receiver = fork() == 0) { /* child process */ runReceiver(RWpipe); } else if(pid_receiver < 0) { printf("Error: could not fork receiver."); exit(1); // exit with code 1 } // close pipe ends close(RWpipe[0]); close(RWpipe[1]); // sleep for 30 sec sleep(30); // print printf("Main process %d has terminated.\n", getpid()); return 0; }