summaryrefslogtreecommitdiff
path: root/src/test/test_spinlock.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-11-16 06:35:51 +0100
committerHaru <haru@dotalux.com>2014-11-16 07:16:23 +0100
commit02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f (patch)
tree3161fd5786bb563c32059068eb3b4876d2ae11ca /src/test/test_spinlock.c
parent31bff051ee3c353fb7ee5e544d68feeaefd4941f (diff)
downloadhercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.tar.gz
hercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.tar.bz2
hercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.tar.xz
hercules-02fcaed6bd32b0ffbc4f03b8f9de6f0720e6253f.zip
Whitespace cleanup (no code changes)
This includes, and is not limited to: mixed or wrong indentation, excess whitespace (horizontal and vertical), misalignment, trailing spaces. Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/test/test_spinlock.c')
-rw-r--r--src/test/test_spinlock.c26
1 files changed, 11 insertions, 15 deletions
diff --git a/src/test/test_spinlock.c b/src/test/test_spinlock.c
index 19a25f9d2..1b31e9b46 100644
--- a/src/test/test_spinlock.c
+++ b/src/test/test_spinlock.c
@@ -25,19 +25,19 @@ static volatile int32 done_threads = 0;
static void *worker(void *p){
register int i;
-
+
for(i = 0; i < PERINC; i++){
EnterSpinLock(&lock);
EnterSpinLock(&lock);
-
+
val++;
-
+
LeaveSpinLock(&lock);
LeaveSpinLock(&lock);
}
-
+
InterlockedIncrement(&done_threads);
-
+
return NULL;
}//end: worker()
@@ -46,34 +46,31 @@ int do_init(int argc, char **argv){
rAthread *t[THRC];
int j, i;
int ok;
-
+
ShowStatus("==========\n");
ShowStatus("TEST: %u Runs, (%u Threads)\n", LOOPS, THRC);
ShowStatus("This can take a while\n");
ShowStatus("\n\n");
-
+
ok =0;
for(j = 0; j < LOOPS; j++){
val = 0;
done_threads = 0;
-
+
InitializeSpinLock(&lock);
-
for(i =0; i < THRC; i++){
t[i] = rathread_createEx( worker, NULL, 1024*512, RAT_PRIO_NORMAL);
}
-
-
+
while(1){
if(InterlockedCompareExchange(&done_threads, THRC, THRC) == THRC)
break;
-
rathread_yield();
}
-
+
FinalizeSpinLock(&lock);
-
+
// Everything fine?
if(val != (THRC*PERINC) ){
printf("FAILED! (Result: %u, Expected: %u)\n", val, (THRC*PERINC) );
@@ -83,7 +80,6 @@ int do_init(int argc, char **argv){
}
}
-
if(ok != LOOPS){
ShowFatalError("Test failed.\n");