SERiF 0.0.1a
3+1D Stellar Structure and Evolution
Loading...
Searching...
No Matches
LockableDObject.h
Go to the documentation of this file.
1/* ***********************************************************************
2//
3// Copyright (C) 2025 -- The 4D-STAR Collaboration
4// File Author: Emily Boudreaux
5// Last Modified: March 17, 2025
6//
7// 4DSSE is free software; you can use it and/or modify
8// it under the terms and restrictions the GNU General Library Public
9// License version 3 (GPLv3) as published by the Free Software Foundation.
10//
11// 4DSSE is distributed in the hope that it will be useful,
12// but WITHOUT ANY WARRANTY; without even the implied warranty of
13// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14// See the GNU Library General Public License for more details.
15//
16// You should have received a copy of the GNU Library General Public License
17// along with this software; if not, write to the Free Software
18// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19//
20// *********************************************************************** */
21#ifndef LOCKABLE_DOBJECT_H
22#define LOCKABLE_DOBJECT_H
23
24#include "DObject.h"
25#include <mutex>
26
34
40public:
44 LockableDObject() = default;
45
50 DObject& get();
51
55 void lock();
56
60 void unlock();
61
62private:
64 std::mutex mutex_;
65};
66
67#endif // LOCKABLE_DOBJECT_H
Defines the DObject class, a universal data container for the project.
A universal data container class.
Definition DObject.h:89
void unlock()
Unlocks the mutex after thread-safe access.
DObject object_
The underlying DObject instance.
std::mutex mutex_
Mutex for thread-safe access.
DObject & get()
Access the underlying DObject.
void lock()
Locks the mutex to ensure thread-safe access.
LockableDObject()=default
Default constructor.