Anklang 0.3.0-460-gc4ef46ba
ASE — Anklang Sound Engine (C++)

« « « Anklang Documentation
Loading...
Searching...
No Matches
atquit.hh
Go to the documentation of this file.
1 // This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0
2#pragma once
3
4#include <ase/loop.hh>
5
6namespace Ase {
7
8struct ErrorReason {
9 int error = 0;
10 std::string what;
11};
12
13// == atquit ==
14[[noreturn]]
15void atquit_terminate (int exitcode, int pgroup = -1) __attribute__ ((noreturn));
16bool atquit_triggered ();
17void atquit_add (std::function<void()> *func);
18void atquit_del (std::function<void()> *func);
19void atquit_add_removal (const std::string &filename);
20void atquit_del_removal (const std::string &filename);
21void atquit_add_killl_pid (int pid);
22void atquit_del_killl_pid (int pid);
23
24std::string create_tempfile_dir (const std::string &basename = "");
25void cleanup_orphaned_tempfiles (const std::string &directory);
26ErrorReason spawn_process (const std::vector<std::string> &argv, pid_t *child_pid, int pdeathsig = -1);
27
28} // Ase
The Anklang C++ API namespace.
Definition api.hh:9
void atquit_add_removal(const std::string &filename)
Remove filename (or directory) when the program terminates.
Definition atquit.cc:106
ErrorReason spawn_process(const std::vector< std::string > &argv, pid_t *child_pid, int pdeathsig)
Span a child process after cleaning up the environment.
Definition atquit.cc:179
void atquit_del_killl_pid(int pid)
Undo a previous atquit_add_killl_pid() call.
Definition atquit.cc:172
void atquit_del_removal(const std::string &filename)
Undo a previous atquit_add_removal() call.
Definition atquit.cc:113
void cleanup_orphaned_tempfiles(const std::string &directory)
Delete all files that contain @TEMPFILE_PID=d@ without a running pid_t d.
Definition atquit.cc:20
void atquit_add_killl_pid(int pid)
Kill pid when the program terminates.
Definition atquit.cc:165
std::string create_tempfile_dir(const std::string &basename)
Create temporary directory under /tmp, scheduled for removal atquit.
Definition atquit.cc:233