Ports lock_test to Linux
authorBarret Rhoden <brho@cs.berkeley.edu>
Thu, 2 Oct 2014 01:43:47 +0000 (18:43 -0700)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 2 Oct 2014 01:49:26 +0000 (18:49 -0700)
commitc498a41d1d078681b0ba9a068b8638a7d87ae022
treee7398d52a808170fcafebc46b67f084ed1facf80
parent670a57200bfb30b6d9257dba21dc1ab7b58d2edd
Ports lock_test to Linux

Build from your AKAROS_ROOT directory with:

$ gcc -O2 -std=gnu99 -fno-stack-protector -g tests/lock_test.c \
  -lpthread -lm -o linux_lock_test

Linux only has the spin and mcs/mcscas available, so the others are
stubs.  It will attempt to pin the worker threads to physical cores
0..n.  If you do your own tasksetting after the program is running, you
can override that.  That might be useful if you want to fake preemption.

The ugliest thing is #including the lock source code in a .h file.
Doing it with measure.c is only slightly less nastry.  Maybe we can get
some linux make targets or something, and put this compat stuff in one
place.
tests/linux-lock-hacks.h [new file with mode: 0644]
tests/lock_test.c