File tree Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Expand file tree Collapse file tree 1 file changed +14
-13
lines changed Original file line number Diff line number Diff line change @@ -110,21 +110,22 @@ mod init {
110
110
// * we only set atomics or call functions that do
111
111
// * there is no use of the heap
112
112
let interrupt = interrupt. clone ( ) ;
113
+ let action = move || {
114
+ static INTERRUPT_COUNT : AtomicUsize = AtomicUsize :: new ( 0 ) ;
115
+ if !super :: is_triggered ( ) {
116
+ INTERRUPT_COUNT . store ( 0 , Ordering :: SeqCst ) ;
117
+ }
118
+ let msg_idx = INTERRUPT_COUNT . fetch_add ( 1 , Ordering :: SeqCst ) ;
119
+ if msg_idx == grace_count {
120
+ gix_tempfile:: registry:: cleanup_tempfiles_signal_safe ( ) ;
121
+ signal_hook:: low_level:: emulate_default_handler ( * sig) . ok ( ) ;
122
+ }
123
+ interrupt ( ) ;
124
+ super :: trigger ( ) ;
125
+ } ;
113
126
#[ allow( unsafe_code) ]
114
127
unsafe {
115
- let hook_id = signal_hook:: low_level:: register ( * sig, move || {
116
- static INTERRUPT_COUNT : AtomicUsize = AtomicUsize :: new ( 0 ) ;
117
- if !super :: is_triggered ( ) {
118
- INTERRUPT_COUNT . store ( 0 , Ordering :: SeqCst ) ;
119
- }
120
- let msg_idx = INTERRUPT_COUNT . fetch_add ( 1 , Ordering :: SeqCst ) ;
121
- if msg_idx == grace_count {
122
- gix_tempfile:: registry:: cleanup_tempfiles_signal_safe ( ) ;
123
- signal_hook:: low_level:: emulate_default_handler ( * sig) . ok ( ) ;
124
- }
125
- interrupt ( ) ;
126
- super :: trigger ( ) ;
127
- } ) ?;
128
+ let hook_id = signal_hook:: low_level:: register ( * sig, action) ?;
128
129
hooks. push ( ( * sig, hook_id) ) ;
129
130
}
130
131
}
You can’t perform that action at this time.
0 commit comments