r870: Merge 2.1:
[cinelerra_cv.git] / cinelerra / sighandler.C
blobc6c2b4e8e7a58f2f186ad54cf67697aa695513e3
1 #include "asset.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         }
22 void SigHandler::push_file(File *file)
24 // Check for duplicate
25         for(int i = 0; i < files.total; i++)
26         {
27                 if(files.values[i] == file)
28                 {
29                         printf("SigHandler::push_file: file %s already on table.\n",
30                                 file->asset->path);
31                         return;
32                 }
33         }
35 // Append file
36         files.append(file);
39 void SigHandler::pull_file(File *file)
41         for(int i = 0; i < files.total; i++)
42         {
43                 if(files.values[i] == file)
44                 {
45                         files.remove_number(i);
46                         return;
47                 }
48         }
49         printf("SigHandler::pull_file: file %s not on table.\n",
50                 file->asset->path);