From 43509b349e5d7e4d7044ec462cebe11535d9dd54 Mon Sep 17 00:00:00 2001 From: Brian Norris Date: Tue, 9 Oct 2012 18:09:20 -0700 Subject: [PATCH] mcs-lock: add trivial driver, link with build system This benchmark doesn't do much yet. --- Makefile | 2 +- mcs-lock/Makefile | 11 +++++++++++ mcs-lock/mcs-lock.cc | 14 ++++++++++++++ 3 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 mcs-lock/Makefile create mode 100644 mcs-lock/mcs-lock.cc diff --git a/Makefile b/Makefile index 26349f7..028a946 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,4 @@ -DIRS := barrier +DIRS := barrier mcs-lock .PHONY: subdirs $(DIRS) diff --git a/mcs-lock/Makefile b/mcs-lock/Makefile new file mode 100644 index 0000000..04d2398 --- /dev/null +++ b/mcs-lock/Makefile @@ -0,0 +1,11 @@ +include ../benchmarks.mk + +TESTNAME = mcs-lock + +all: $(TESTNAME) + +$(TESTNAME): $(TESTNAME).cc $(TESTNAME).h + $(CXX) -o $@ $< $(CPPFLAGS) $(LDFLAGS) + +clean: + rm -f $(TESTNAME) *.o diff --git a/mcs-lock/mcs-lock.cc b/mcs-lock/mcs-lock.cc new file mode 100644 index 0000000..135085f --- /dev/null +++ b/mcs-lock/mcs-lock.cc @@ -0,0 +1,14 @@ +#include +#include + +#include "mcs-lock.h" + +struct mcs_mutex *mutex; + +int user_main(int argc, char **argv) +{ + mcs_mutex::guard *g = new mcs_mutex::guard(mutex); + mutex->lock(g); + mutex->unlock(g); + return 0; +} -- 2.34.1