Skip to content
Snippets Groups Projects
Commit c7c456e9 authored by Nadav Har'El's avatar Nadav Har'El
Browse files

Fix build error

Change lockfree::mutex to use "protected" instead of "private".
This allows tst-mutex to extend it and mess with the internals
(I want to modify count, to benchmark the rare "handoff" case).

Sorry about the build error.
parent e3ee4238
No related branches found
No related tags found
No related merge requests found
......@@ -54,7 +54,7 @@ namespace sched {
namespace lockfree {
class mutex {
private:
protected:
std::atomic<int> count;
// "owner" and "depth" are only used for implementing a recursive mutex.
// "depth" is not an atomic variable - only the lock-owning thread sets
......@@ -67,6 +67,9 @@ private:
std::atomic<unsigned int> handoff;
unsigned int sequence;
public:
// Note: mutex's constructor just initializes the whole structure to
// zero, and its destructor does nothing. This is useful to know when
// allocating a mutex in C.
mutex() : count(0), depth(0), owner(nullptr), waitqueue(), handoff(0), sequence(0) { }
~mutex() { /*assert(count==0);*/ }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment