r125: This commit was manufactured by cvs2svn to create tag 'r1_1_7-last'.
[cinelerra_cv/mob.git] / hvirtual / cinelerra / sighandler.C
blob5d20fa6116355bba7a7a0e00b42ac2f2757670dd
1 #include "assets.h"
2 #include "file.h"
3 #include "sighandler.h"
6 SigHandler::SigHandler()
7  : BC_Signals()
11 void SigHandler::signal_handler(int signum)
13         printf("SigHandler::signal_handler total files=%d\n", 
14                 files.total);
15         for(int i = 0; i < files.total; i++)
16         {
17                 printf("Closing %s\n", files.values[i]->asset->path);
18                 files.values[i]->close_file(1);
19         }
20         BC_Signals::signal_handler(signum);
23 void SigHandler::push_file(File *file)
25 // Check for duplicate
26         for(int i = 0; i < files.total; i++)
27         {
28                 if(files.values[i] == file)
29                 {
30                         printf("SigHandler::push_file: file %s already on table.\n",
31                                 file->asset->path);
32                         return;
33                 }
34         }
36 // Append file
37         files.append(file);
40 void SigHandler::pull_file(File *file)
42         for(int i = 0; i < files.total; i++)
43         {
44                 if(files.values[i] == file)
45                 {
46                         files.remove_number(i);
47                         return;
48                 }
49         }
50         printf("SigHandler::pull_file: file %s not on table.\n",
51                 file->asset->path);