00001 /* 00002 * This file is part of scribble. 00003 * 00004 * scribble is free software: you can redistribute it and/or modify 00005 * it under the terms of the GNU General Public License as published by 00006 * the Free Software Foundation, either version 2 of the License, or 00007 * (at your option) any later version. 00008 * 00009 * scribble is distributed in the hope that it will be useful, 00010 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00011 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00012 * GNU General Public License for more details. 00013 * 00014 * You should have received a copy of the GNU General Public License 00015 * along with this program. If not, see <http://www.gnu.org/licenses/>. 00016 */ 00017 00023 /* 00024 * C Implementation: ScribbleSignalDeal 00025 * 00026 * Description: 00027 * 00028 * 00029 * Author: Jian Shen, (C) 2006 00030 * 00031 * Copyright: See COPYING file that comes with this distribution 00032 * 00033 */ 00034 00035 #include "ScribbleUI.h" 00036 #include "ScribbleSignalDeal.h" 00037 #include "ScribbleLog.h" 00038 #include "ScribbleCore.h" 00039 #include "ScribbleSaveThread.h" 00040 #include "erbusy.h" 00041 00042 #include <signal.h> 00043 00044 static ScribbleUICtx *pCurrScribbleUICtx=NULL; 00045 00046 // signal handlers 00047 static void on_sigterm(int signo) 00048 { 00049 // stop main process 00050 SB_TIMEDISPLAY("\n caught signal to term\n"); 00051 gdk_threads_enter();//need it in getpixmap... 00052 quit(pCurrScribbleUICtx); 00053 gdk_threads_leave(); 00054 } 00055 00056 //deal the signal "term" 00057 void dealTermSignal(ScribbleUICtx *pScribbleUICtx) 00058 { 00059 // catch the SIGTERM signal 00060 struct sigaction on_term; 00061 00062 pCurrScribbleUICtx=pScribbleUICtx; 00063 memset(&on_term, 0x00, sizeof(on_term)); 00064 on_term.sa_handler = on_sigterm; 00065 sigaction(SIGTERM, &on_term, NULL); 00066 } 00067
1.5.6