diff --git a/02/concurrency/Makefile b/02/concurrency/Makefile index 5fc9407..3951239 100644 --- a/02/concurrency/Makefile +++ b/02/concurrency/Makefile @@ -2,11 +2,11 @@ all: threads threads-notv CFLAGS=-fcf-protection=none -fno-asynchronous-unwind-tables -m32 -fno-pie -no-pie -threads: threads.c common.h common_threads.h +threads: threads.c common_threads.h gcc $(CFLAGS) -m32 -O1 -S threads.c gcc $(CFLAGS) -m32 -o threads threads.s -Wall -pthread -threads-notv: threads-notv.c common.h common_threads.h +threads-notv: threads-notv.c common_threads.h gcc $(CFLAGS) -m32 -O1 -S threads-notv.c gcc $(CFLAGS) -m32 -o threads-notv threads-notv.s -Wall -pthread diff --git a/02/concurrency/common.h b/02/concurrency/common.h deleted file mode 100644 index 199b622..0000000 --- a/02/concurrency/common.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __common_h__ -#define __common_h__ - -#include -#include -#include -#include - -double GetTime() { - struct timeval t; - int rc = gettimeofday(&t, NULL); - assert(rc == 0); - return (double) t.tv_sec + (double) t.tv_usec/1e6; -} - -void Spin(int howlong) { - double t = GetTime(); - while ((GetTime() - t) < (double) howlong) - ; // do nothing in loop -} - -#endif // __common_h__ diff --git a/02/concurrency/threads-notv.c b/02/concurrency/threads-notv.c index e629273..afd2e4e 100644 --- a/02/concurrency/threads-notv.c +++ b/02/concurrency/threads-notv.c @@ -1,6 +1,5 @@ #include #include -#include "common.h" #include "common_threads.h" int counter = 0; @@ -16,7 +15,7 @@ void *worker(void *arg) { int main(int argc, char *argv[]) { if (argc != 2) { - fprintf(stderr, "usage: threads \n"); + fprintf(stderr, "usage: threads-notv \n"); exit(1); } loops = atoi(argv[1]); diff --git a/02/concurrency/threads.c b/02/concurrency/threads.c index cdcd2b2..7a68cda 100644 --- a/02/concurrency/threads.c +++ b/02/concurrency/threads.c @@ -1,6 +1,5 @@ #include #include -#include "common.h" #include "common_threads.h" volatile int counter = 0;