blob: 3573b9973b2ce4ac5cd9e0bf3c4f763fad73273e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/* Copyright (C) 2000 MySQL AB
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; version 2 of the License.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */
/* Dont let the user break when you are doing something important */
/* Remembers if it got 'SIGINT' and executes it on allow_break */
/* A static buffer is used; don't call dont_break() twice in a row */
#include "mysys_priv.h"
#include "my_static.h"
/* Set variable that we can't break */
#if !defined(THREAD)
void dont_break(void)
{
my_dont_interrupt=1;
return;
} /* dont_break */
void allow_break(void)
{
{
reg1 int index;
my_dont_interrupt=0;
if (_my_signals)
{
if (_my_signals > MAX_SIGNALS)
_my_signals=MAX_SIGNALS;
for (index=0 ; index < _my_signals ; index++)
{
if (_my_sig_remember[index].func) /* Safequard */
{
(*_my_sig_remember[index].func)(_my_sig_remember[index].number);
_my_sig_remember[index].func=0;
}
}
_my_signals=0;
}
}
} /* dont_break */
#endif
/* Set old status */
#if !defined(THREAD)
void my_remember_signal(int signal_number, sig_handler (*func) (int))
{
#ifndef __WIN__
reg1 int index;
index=_my_signals++; /* Nobody can break a ++ ? */
if (index < MAX_SIGNALS)
{
_my_sig_remember[index].number=signal_number;
_my_sig_remember[index].func=func;
}
#endif /* __WIN__ */
} /* my_remember_signal */
#endif /* THREAD */
|