Full-node GUI wallet for DragonX cryptocurrency. Built with Dear ImGui, SDL3, and OpenGL3/DX11. Features: - Send/receive shielded and transparent transactions - Autoshield with merged transaction display - Built-in CPU mining (xmrig) - Peer management and network monitoring - Wallet encryption with PIN lock - QR code generation for receive addresses - Transaction history with pagination - Console for direct RPC commands - Cross-platform (Linux, Windows)
56 lines
1.1 KiB
C++
56 lines
1.1 KiB
C++
// DragonX Wallet - ImGui Edition
|
|
// Copyright 2024-2026 The Hush Developers
|
|
// Released under the GPLv3
|
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
namespace dragonx {
|
|
namespace util {
|
|
|
|
/**
|
|
* @brief Ensures only one instance of the wallet runs at a time
|
|
*
|
|
* Uses file locking on Linux/macOS and named mutex on Windows.
|
|
*/
|
|
class SingleInstance {
|
|
public:
|
|
SingleInstance(const std::string& app_name = "dragonx-wallet");
|
|
~SingleInstance();
|
|
|
|
// Non-copyable
|
|
SingleInstance(const SingleInstance&) = delete;
|
|
SingleInstance& operator=(const SingleInstance&) = delete;
|
|
|
|
/**
|
|
* @brief Try to acquire the single instance lock
|
|
* @return true if lock acquired (this is the only instance)
|
|
*/
|
|
bool tryLock();
|
|
|
|
/**
|
|
* @brief Release the lock
|
|
*/
|
|
void unlock();
|
|
|
|
/**
|
|
* @brief Check if lock is currently held
|
|
*/
|
|
bool isLocked() const { return locked_; }
|
|
|
|
private:
|
|
std::string app_name_;
|
|
bool locked_ = false;
|
|
|
|
#ifdef _WIN32
|
|
void* mutex_handle_ = nullptr;
|
|
#else
|
|
int lock_fd_ = -1;
|
|
std::string lock_path_;
|
|
#endif
|
|
};
|
|
|
|
} // namespace util
|
|
} // namespace dragonx
|