diff options
author | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-10 08:25:32 +0100 |
---|---|---|
committer | Sebastian Huber <sebastian.huber@embedded-brains.de> | 2014-03-11 10:58:09 +0100 |
commit | d50acdbb6c8213114ce887a56daea02697c9e1a1 (patch) | |
tree | e48fb252786992308fa2dd6337c8a02db35bd10b /testsuites/smptests | |
parent | sapi: Use one SMP lock for all chains (diff) | |
download | rtems-d50acdbb6c8213114ce887a56daea02697c9e1a1.tar.bz2 |
score: Add local context to SMP lock API
Add a local context structure to the SMP lock API for acquire and
release pairs. This context can be used to store the ISR level and
profiling information. It may be later used to enable more
sophisticated lock algorithms, e.g. MCS locks.
There is only one lock that cannot be used with a local context. This
is the per-CPU lock since here we would have to transfer the local
context through a context switch which is very complicated.
Diffstat (limited to 'testsuites/smptests')
-rw-r--r-- | testsuites/smptests/smplock01/init.c | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/testsuites/smptests/smplock01/init.c b/testsuites/smptests/smplock01/init.c index d45448797f..d67d7bc07e 100644 --- a/testsuites/smptests/smplock01/init.c +++ b/testsuites/smptests/smplock01/init.c @@ -97,10 +97,11 @@ static void test_0_body( ) { unsigned long counter = 0; + SMP_lock_Context lock_context; while (assert_state(ctx, START_TEST)) { - _SMP_lock_Acquire(&ctx->lock); - _SMP_lock_Release(&ctx->lock); + _SMP_lock_Acquire(&ctx->lock, &lock_context); + _SMP_lock_Release(&ctx->lock, &lock_context); ++counter; } @@ -116,11 +117,12 @@ static void test_1_body( ) { unsigned long counter = 0; + SMP_lock_Context lock_context; while (assert_state(ctx, START_TEST)) { - _SMP_lock_Acquire(&ctx->lock); + _SMP_lock_Acquire(&ctx->lock, &lock_context); ++ctx->counter[test]; - _SMP_lock_Release(&ctx->lock); + _SMP_lock_Release(&ctx->lock, &lock_context); ++counter; } @@ -137,10 +139,11 @@ static void test_2_body( { unsigned long counter = 0; SMP_lock_Control lock = SMP_LOCK_INITIALIZER; + SMP_lock_Context lock_context; while (assert_state(ctx, START_TEST)) { - _SMP_lock_Acquire(&lock); - _SMP_lock_Release(&lock); + _SMP_lock_Acquire(&lock, &lock_context); + _SMP_lock_Release(&lock, &lock_context); ++counter; } @@ -157,14 +160,15 @@ static void test_3_body( { unsigned long counter = 0; SMP_lock_Control lock = SMP_LOCK_INITIALIZER; + SMP_lock_Context lock_context; while (assert_state(ctx, START_TEST)) { - _SMP_lock_Acquire(&lock); + _SMP_lock_Acquire(&lock, &lock_context); /* The counter value is not interesting, only the access to it */ ++ctx->counter[test]; - _SMP_lock_Release(&lock); + _SMP_lock_Release(&lock, &lock_context); ++counter; } @@ -189,11 +193,12 @@ static void test_4_body( ) { unsigned long counter = 0; + SMP_lock_Context lock_context; while (assert_state(ctx, START_TEST)) { - _SMP_lock_Acquire(&ctx->lock); + _SMP_lock_Acquire(&ctx->lock, &lock_context); busy_section(); - _SMP_lock_Release(&ctx->lock); + _SMP_lock_Release(&ctx->lock, &lock_context); ++counter; } |