VirtualC64
v5.0 beta
Commodore 64 Emulator
Loading...
Searching...
No Matches
Synchronizable.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 "Concurrency.h"
16
17
namespace
vc64
{
18
19
class
Synchronizable {
20
21
public
:
22
23
/* Mutex for implementing the 'synchronized' macro. The macro can be used
24
* to prevent multiple threads to enter the same code block. It mimics the
25
* behaviour of the well known Java construct 'synchronized(this) { }'.
26
*/
27
mutable
util::ReentrantMutex mutex;
28
29
};
30
31
/* The following macro can be utilized to prevent multiple threads to enter the
32
* same code block. It mimics the behaviour of the Java construct
33
* 'synchronized(this) { }'. To secure a code-block, use the following syntax:
34
*
35
* { SYNCHRONIZED
36
*
37
* <command>
38
* ...
39
* }
40
*/
41
#define SYNCHRONIZED util::AutoMutex _am(mutex);
42
43
}
vc64
VirtualC64 project namespace.
Definition
CmdQueue.cpp:16
Emulator
Base
Synchronizable.h
Generated by
1.10.0