7 BC_Signals* BC_Signals::signals_object = 0;
9 static char* signal_titles[] =
29 BC_Signals::BC_Signals()
31 BC_Signals::signals_object = this;
33 signal(SIGHUP, signal_entry);
34 signal(SIGINT, signal_entry);
35 signal(SIGQUIT, signal_entry);
36 signal(SIGKILL, signal_entry);
37 signal(SIGSEGV, signal_entry);
38 signal(SIGTERM, signal_entry);
39 execution_table.set_array_delete();
43 void BC_Signals::signal_entry(int signum)
45 signals_object->lock->lock();
46 printf("BC_Signals::signal_handler: got %s execution_table.total=%d\n",
47 signal_titles[signum],
48 signals_object->execution_table.total);
49 if(signals_object->execution_table.total)
51 for(int i = 0; i < signals_object->execution_table.total; i++)
52 printf(" %s\n", signals_object->execution_table.values[i]);
54 signals_object->signal_handler(signum);
55 signals_object->lock->unlock();
58 void BC_Signals::signal_handler(int signum)
63 char* BC_Signals::sig_to_str(int number)
65 return signal_titles[number];
68 void BC_Signals::new_function(char *name)
70 //printf("BC_Signals::new_function 1 %p\n", signals_object);
71 signals_object->lock->lock();
72 //printf("BC_Signals::new_function 1\n");
73 char *dup_name = new char[strlen(name)+1];
74 strcpy(dup_name, name);
75 signals_object->execution_table.append(dup_name);
76 //printf("BC_Signals::new_function 1\n");
77 signals_object->lock->unlock();
78 //printf("BC_Signals::new_function 10\n");
81 void BC_Signals::delete_function(char *name)
83 signals_object->lock->lock();
84 for(int i = 0; i < signals_object->execution_table.total; i++)
86 if(!strcmp(signals_object->execution_table.values[i], name))
88 signals_object->execution_table.remove_object_number(i);
92 signals_object->lock->unlock();