make members atomic
This commit is contained in:
@ -14,7 +14,7 @@ class Drive
|
||||
{
|
||||
|
||||
public:
|
||||
enum TaskState
|
||||
enum class TaskState
|
||||
{
|
||||
NONE,
|
||||
SHRED_SELECTED,
|
||||
@ -23,15 +23,15 @@ public:
|
||||
DELETE_SELECTED,
|
||||
DELETE_ACTIVE,
|
||||
FROZEN
|
||||
} state;
|
||||
};
|
||||
|
||||
enum ConnectionType
|
||||
enum class ConnectionType
|
||||
{
|
||||
UNKNOWN,
|
||||
USB,
|
||||
SATA,
|
||||
NVME
|
||||
} connectionType;
|
||||
};
|
||||
|
||||
struct
|
||||
{
|
||||
@ -41,6 +41,9 @@ public:
|
||||
unsigned long ulSpeedMetricBytesWritten;
|
||||
} sShredSpeed;
|
||||
|
||||
std::atomic<TaskState> state;
|
||||
std::atomic<ConnectionType> connectionType;
|
||||
|
||||
bool bWasShredded = false; // all shred iterations done
|
||||
bool bWasShredStarted = false; // shred was atleast once started
|
||||
bool bWasChecked = false; // all shred iterations and optional checking done
|
||||
|
||||
@ -56,6 +56,7 @@
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include <signal.h>
|
||||
#include <atomic>
|
||||
#include "drive.h"
|
||||
#include "smart.h"
|
||||
#include "shred.h"
|
||||
|
||||
@ -67,7 +67,7 @@ private:
|
||||
|
||||
static void centerTitle(WINDOW *pwin, const char *title);
|
||||
static WINDOW *createOverViewWindow(int iXSize, int iYSize);
|
||||
static WINDOW *createDetailViewWindow(int iXSize, int iYSize, int iXStart, Drive drive);
|
||||
static WINDOW *createDetailViewWindow(int iXSize, int iYSize, int iXStart, Drive &drive);
|
||||
static WINDOW *overwriteDetailViewWindow(int iXSize, int iYSize, int iXStart);
|
||||
static WINDOW *createEntryWindow(int iXSize, int iYSize, int iXStart, int iYStart, int iListIndex, std::string sModelFamily, std::string sSerial, std::string sCapacity, std::string sState, std::string sTime, std::string sSpeed, std::string sTemp, std::string sConnection, bool bSelected);
|
||||
static WINDOW *createSystemStats(int iXSize, int iYSize, int iXStart, int iYStart);
|
||||
@ -77,7 +77,7 @@ private:
|
||||
static WINDOW *createSmartWarning(int iXSize, int iYSize, int iXStart, int iYStart, std::string sPath, uint32_t u32PowerOnHours, uint32_t u32PowerCycles, uint32_t u32ErrorCount, uint32_t u32Temperature);
|
||||
static WINDOW *createZeroChecksumWarning(int iXSize, int iYSize, int iXStart, int iYStart, std::string sPath, std::string sModelFamily, std::string sModelName, std::string sSerial, uint32_t u32Checksum);
|
||||
|
||||
void displaySelectedDrive(Drive drive, int stdscrX, int stdscrY);
|
||||
void displaySelectedDrive(Drive &drive, int stdscrX, int stdscrY);
|
||||
std::string formatTimeDuration(time_t u32Duration);
|
||||
std::string formatSpeed(time_t u32ShredTimeDelta, unsigned long ulWrittenBytes);
|
||||
static void vTruncateText(std::string *psText, uint16_t u16MaxLenght);
|
||||
|
||||
Reference in New Issue
Block a user