concurrencyc/include/sum.h
Christopher Hamer 5da509e373 initial commit
2024-07-05 17:14:16 +01:00

25 lines
307 B
C++

//
// Created by Christopher Hamer on 19/06/2024.
//
#include <mutex>
#ifndef TASK1_SUM_H
#define TASK1_SUM_H
// Thread-safe sum accumulator
class SumAccumulator {
public:
void add(int value);
long long getTotal();
private:
long long sum = 0;
std::mutex mtx;
};
#endif //TASK1_SUM_H