fork SMS sending process
This commit is contained in:
		
							
								
								
									
										15
									
								
								yasnd-ipc.c
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								yasnd-ipc.c
									
									
									
									
									
								
							| @@ -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); | ||||
| 	} | ||||
| } | ||||
|  | ||||
|   | ||||
		Reference in New Issue
	
	Block a user