diff -r f345bda72bc4 -r 43e37759235e Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/sigusr2_8c-source.html --- a/Symbian3/Examples/guid-6013a680-57f9-415b-8851-c4fa63356636/sigusr2_8c-source.html Tue Mar 30 11:56:28 2010 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,84 +0,0 @@ - -
-00001 // sigusr2.c -00002 // -00003 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). -00004 // All rights reserved. -00005 // This component and the accompanying materials are made available -00006 // under the terms of "Eclipse Public License v1.0" -00007 // which accompanies this distribution, and is available -00008 // at the URL "http://www.eclipse.org/legal/epl-v10.html". -00009 // -00010 // Initial Contributors: -00011 // Nokia Corporation - initial contribution. -00012 // -00013 // Contributors: -00014 // -00015 // Description: The source file for sigusr2 process. -00016 // -00017 -00018 #include <stdio.h> -00019 #include <stdlib.h> -00020 #include <signal.h> -00021 #include <unistd.h> -00022 #include <e32def.h> -00023 -00027 int gVal = TRUE; -00028 -00033 void SIGUSR2_handler(int signum) -00034 { -00035 if(signum == SIGUSR2) -00036 { -00037 printf("Received the SIGUSR2 signal from the sigusr1 process after reading the file.\n"); -00038 gVal = FALSE; -00039 } -00040 } -00041 -00049 int main(int argc,char **argv) -00050 { -00051 pid_t asyProcsID = atoi(argv[1]); //The variable holding the sigusr1 process PID. -00052 char ch; -00053 int ret; -00054 int arg = argc; -00055 // Setup the custom handler for SIGUSR2. -00056 signal(SIGUSR2, SIGUSR2_handler); -00057 printf("******************** In the sigusr2 process ********************\n"); -00058 -00059 printf("\nPress the Enter key to send the SIGUSR1 signal to the sigusr1 process\n"); -00060 getchar(); -00061 ret = kill(asyProcsID,SIGUSR1); -00062 if(ret) -00063 { -00064 printf("kill() failed to send signal, errno=%d\n",errno); -00065 gVal = FALSE; -00066 } -00067 -00068 /* -00069 Waiting until a SIGUSR2 signal is obtained from the sigusr1 process. -00070 This signal is sent after the aynscFile.txt file has been -00071 read and its content written to the console. -00072 */ -00073 while(gVal) -00074 { -00075 sleep(0); //Initiates signal handling. -00076 } -00077 printf("\nPress 'e'+Enter to exit from the sigusr2 process\n"); -00078 while((ch = getchar())!= 'e') -00079 { -00080 if(ch == '\n') -00081 continue; -00082 else -00083 printf("The wrong option was selected, please try again!!!\n"); -00084 } -00085 return EXIT_SUCCESS; -00086 } -