atexit Questions
3
I have some subprocesses (using multiprocessing) and when they stop, each of them need do some final work. Something like the following, which did not work though...
import multiprocessing
import...
Yellows asked 29/12, 2015 at 7:39
3
Solved
If I place atexit( fn ); on the exit stack, it will get executed when the program exits: returns from main() or via exit().
Can I remove it from the stack?
Why do I want to do this, you ask?
I w...
4
Solved
I have a python process which runs in background, and I would like it to generate some output only when the script is terminated.
def handle_exit():
print('\nAll files saved in ' + directory)
ge...
Prosimian asked 29/11, 2016 at 13:0
2
Solved
I want to know if a Python script is terminating correctly or not. For this I am using atexit but the problem is that I do not know how to differentiate if atexit was called with sys.exit(0) or non...
1
Solved
Assume I have a module SomeModule.jl:
module SomeModule
export use_me
function use_me()
println("I'm useful!")
end
function call_me_in_the_end()
println("This is the end")
...
2
Solved
I am trying to run a simple multiple processes application in Python. The main thread spawns 1 to N processes and waits until they all done processing. The processes each run an infinite loop, so t...
3
Solved
According to the man page (2) the exit function is not thread safe : MT-Unsafe race:exit, this is because this function tries to clean up resources (flush data to the disk, close file descriptors, ...
Hyperkeratosis asked 23/7, 2019 at 10:4
2
I'm playing around with threads on python 3.7.4, and I want to use atexit to register a cleanup function that will (cleanly) terminate the threads.
For example:
# example.py
import threading
impo...
Jackal asked 18/11, 2019 at 8:15
2
Solved
1
Solved
cppreference says about std::atexit :
The functions may be called concurrently with the destruction of the objects with static storage duration and with each other, maintaining the guarantee tha...
Nancee asked 16/5, 2018 at 19:53
2
I'm having some difficulties determining what is causing a process to exit. I have a breakpoint in some shutdown code that I'm debugging, but, after breaking in the debugger at the breakpoint and s...
Ghee asked 14/9, 2017 at 13:52
3
Solved
I'm creating a terminal text editor in Rust. The editor puts the terminal into raw mode, disabling character echoing and the like, and then restores the original terminal function upon exit.
Howev...
1
Solved
In the GCC docs I found the -fuse-cxa-atexit option and it says the following:
This option is required for fully standards-compliant handling of static destructors
So what is the difference be...
2
Solved
I'm trying to avoid false positives with valgrind, but I'm suck with a combination of atexit() and fork(), despite using --trace-children=yes. My code:
#include <stdio.h>
#include <unistd...
Carrigan asked 9/2, 2017 at 17:57
1
When our UNIX/C program needs an emergency exit, we use exit (3) function and install atexit (3) handlers for emergency clean-ups. This approach worked fine until our application got threaded, at w...
3
Solved
I am having a problem with a C++/CLI mixed mode DLL that I created. It is throwing an exception when unloading as the .NET application that uses it exits. After DLL_PROCESS_DETACH is executed, the ...
Tangier asked 15/11, 2011 at 23:28
1
Solved
The Rust program below panics when it accesses stdout in the atexit handler.
extern crate libc;
extern "C" fn bye() {
println!("bye");
}
fn main() {
println!("hello");
unsafe { libc::atexit(b...
3
Solved
I'm trying to register a function that returns an int to be called at the end of a program using the atexit() function. (Specifically, the endwin() function from ncurses.)
But since atexit() need...
2
Solved
I am developing a project in C, and I need to free the allocated memory and also close all the open files before it exits.
I decided to implement a clean function that will do all this stuff and c...
1
Solved
I have a piece of Python code as below:
import sys
import signal
import atexit
def release():
print "Release resources..."
def sigHandler(signo, frame):
release()
sys.exit(0)
if __name__ == ...
3
Solved
is it possible to unregister an exit handler function???
void exit_handler_1()
{
printf("in first exit handler\n");
}
int main()
{
if(atexit(exit_handler_1())
{
perror("error");
}
return 0;...
2
Solved
Assume I've got some really big Python class that might consume a fair amount of memory. The class has some method that is responsible for cleaning up some things when the interpreter exits, and it...
1
Solved
The man page for atexit(3) says the following:
POSIX.1-2001 says that the result of calling exit(3) more than once (i.e., calling exit(3) within a function registered using atexit()) is undefine...
2
Solved
Are there inherent dangers in using atexit in large projects such as libraries?
If so, what is it about the technical nature behind atexit that may lead to problems in larger projects?
1
Solved
In C there is the atexit function, which
The atexit() function registers the given function to be called at normal process termination, either via exit(3) or via return from the program's main()...
Helbonnas asked 21/5, 2013 at 15:6
1 Next >
© 2022 - 2024 — McMap. All rights reserved.