VirtualC64
v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
Suspendable.h
1
// -----------------------------------------------------------------------------
2
// This file is part of VirtualC64
3
//
4
// Copyright (C) Dirk W. Hoffmann. www.dirkwhoffmann.de
5
// This FILE is dual-licensed. You are free to choose between:
6
//
7
// - The GNU General Public License v3 (or any later version)
8
// - The Mozilla Public License v2
9
//
10
// SPDX-License-Identifier: GPL-3.0-or-later OR MPL-2.0
11
// -----------------------------------------------------------------------------
12
13
#pragma once
14
15
#include <cstdio>
16
17
namespace
vc64
{
18
20
class
Suspendable
{
21
22
public
:
23
24
Suspendable
() { }
25
virtual
~Suspendable
() =
default
;
26
28
virtual
void
suspend
() = 0;
29
31
virtual
void
resume
() = 0;
32
};
33
34
struct
AutoResume {
35
36
Suspendable
*s;
37
AutoResume(
Suspendable
*s) : s(s) { s->
suspend
(); }
38
~AutoResume() { s->
resume
(); }
39
};
40
41
#define SUSPENDED AutoResume _ar(this);
42
43
}
vc64::Suspendable
Suspend-resume mechanism.
Definition
Suspendable.h:20
vc64::Suspendable::suspend
virtual void suspend()=0
Suspends the thread.
vc64::Suspendable::resume
virtual void resume()=0
Resumes the thread.
vc64
VirtualC64 project namespace.
Definition
CmdQueue.cpp:16
Emulator
Base
Suspendable.h
Generated by
1.10.0