fork SMS sending process

This commit is contained in:
Sergey Popov 2011-12-20 13:23:13 +04:00
parent d8829305fc
commit fba4ffb66e

View File

@ -74,9 +74,20 @@ int ipc_queue_loop()
if (qbuf.mtype==SMS_SEND_TYPE && sms_send_enable)
{
log_debug(qbuf.mtext,DEBUG_BASE);
gammu_send_sms(qbuf.mtext);
pid_t pid = fork();
if (pid < 0) {
log_event("Error: can not fork child :(");
exit(EXIT_FAILURE);
}
// If pid == 0, then we are in the child
if (pid == 0) {
gammu_send_sms(qbuf.mtext);
exit(EXIT_SUCCESS);
}
// wait for SMS sending thread
// STUB: need to react on status, returned by thread
waitpid(pid,NULL,0);
}
sleep(6);
}
}