dsrc isn't necessary for this repo
[client-tools.git] / src / external / 3rd / library / perforce / include / signaler.h
blob58cc61bcf1f1ac2b2a3e4ee628ed2abb885020f9
1 /*
2 * Copyright 1995, 1996 Perforce Software. All rights reserved.
4 * This file is part of Perforce - the FAST SCM System.
5 */
7 /*
8 * Signaler.h - catch ^C and delete temp files
10 * A single Signaler is declared globally.
12 * Public methods:
14 * Signaler::Block() -- don't catch the signal until Catch()
15 * Signaler::Catch() -- catch and handle SIGINT
16 * Signaler::OnIntr() -- call a designated function on SIGINT
17 * Signaler::DeleteOnIntr() -- undo OnIntr() call
19 * Signaler::Intr() -- call functions registered by OnIntr()
21 * Requires cooperation from the TempFile objects to delete files.
24 # ifdef OS_NT
25 typedef void *HANDLE;
26 # endif
28 struct SignalMan;
30 typedef void (*SignalFunc)( void *ptr );
32 class Signaler {
34 public:
35 Signaler();
37 void Block();
38 void Catch();
40 void OnIntr( SignalFunc callback, void *ptr );
41 void DeleteOnIntr( void *ptr );
43 void Intr();
45 private:
47 SignalMan *list;
49 # ifdef OS_NT
50 HANDLE hmutex;
51 # endif // OS_NT
53 } ;
55 extern Signaler signaler;