E-MailRelay

gcleanup_win32.cpp
Go to the documentation of this file.
1//
2// Copyright (C) 2001-2024 Graeme Walker <graeme_walker@users.sourceforge.net>
3//
4// This program is free software: you can redistribute it and/or modify
5// it under the terms of the GNU General Public License as published by
6// the Free Software Foundation, either version 3 of the License, or
7// (at your option) any later version.
8//
9// This program is distributed in the hope that it will be useful,
10// but WITHOUT ANY WARRANTY; without even the implied warranty of
11// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12// GNU General Public License for more details.
13//
14// You should have received a copy of the GNU General Public License
15// along with this program. If not, see <http://www.gnu.org/licenses/>.
16// ===
17///
18/// \file gcleanup_win32.cpp
19///
20
21#include "gdef.h"
22#include "gcleanup.h"
23#include <cstring> // _strdup()
24
25 void G::Cleanup::init()
26{
27 // no-op
28}
29
30 void G::Cleanup::add( bool (*)(const Arg &) noexcept , Arg )
31{
32 // not implemented
33}
34
35 void G::Cleanup::atexit( bool )
36{
37 // not implemented
38}
39
40 void G::Cleanup::block() noexcept
41{
42 // not implemented
43}
44
45 void G::Cleanup::release() noexcept
46{
47 // not implemented
48}
49
50 G::Cleanup::Arg G::Cleanup::arg( const char * )
51{
52 return {} ;
53}
54
55 G::Cleanup::Arg G::Cleanup::arg( const std::string & )
56{
57 return {} ;
58}
59
60 G::Cleanup::Arg G::Cleanup::arg( const Path & )
61{
62 Arg arg ;
63 //arg.m_is_path = true ; // fwiw
64 return arg ;
65}
66
67 G::Cleanup::Arg G::Cleanup::arg( std::nullptr_t )
68{
69 return {} ;
70}
71
72 const char * G::Cleanup::Arg::str() const noexcept
73{
74 return m_ptr ;
75}
76
77 bool G::Cleanup::Arg::isPath() const noexcept
78{
79 return m_is_path ;
80}
81
G::Cleanup::arg
static Arg arg(const char *)
Duplicates a c-string for add().
Definition: gcleanup_unix.cpp:117
G::Cleanup::atexit
static void atexit(bool active=true)
Ensures that the cleanup functions are also called via atexit(), in addition to abnormal-termination ...
Definition: gcleanup_unix.cpp:100
G::Cleanup::release
static void release() noexcept
Releases block()ed signals.
Definition: gcleanup_unix.cpp:111
G::Cleanup::block
static void block() noexcept
Temporarily blocks signals until release()d.
Definition: gcleanup_unix.cpp:106
G::Cleanup::init
static void init()
An optional early-initialisation function. May be called more than once.
Definition: gcleanup_unix.cpp:89
G::Cleanup::add
static void add(Fn, Arg arg)
Adds the given handler to the list of handlers that are to be called when the process terminates abno...
Definition: gcleanup_unix.cpp:94
gcleanup.h
G::Cleanup::Arg
Opaque leaky string pointer wrapper created by G::Cleanup::arg().
Definition: gcleanup.h:55