diff options
Diffstat (limited to 'spec/score/sem/req/seize-wait.yml')
-rw-r--r-- | spec/score/sem/req/seize-wait.yml | 47 |
1 files changed, 20 insertions, 27 deletions
diff --git a/spec/score/sem/req/seize-wait.yml b/spec/score/sem/req/seize-wait.yml index 2cc2fdb1..bbc3ae9d 100644 --- a/spec/score/sem/req/seize-wait.yml +++ b/spec/score/sem/req/seize-wait.yml @@ -16,14 +16,23 @@ post-conditions: ${../../status/if/successful:/name}. - name: Enqueued test-code: | - if ( ctx->tq_ctx->base.discipline == TQ_FIFO ) { - ${../../tq/req/enqueue-fifo:/test-run}( &ctx->tq_ctx->base ); - } else { - ${../../tq/req/enqueue-priority:/test-run}( &ctx->tq_ctx->base ); + switch ( ctx->tq_ctx->base.discipline ) { + case TQ_FIFO: + ${../../tq/req/enqueue-fifo:/test-run}( &ctx->tq_ctx->base ); + break; + case TQ_PRIORITY: + ${../../tq/req/enqueue-priority:/test-run}( &ctx->tq_ctx->base ); + break; + default: + T_unreachable(); + break; } text: | - The calling task shall be enqueued in the specified order on the thread - queue used by the semaphore. + Where the thread queue uses the FIFO discipline, the calling thread shall + be enqueued in FIFO order. + + Where the thread queue uses the priority discipline, the calling thread + shall be enqueued in priority order. test-epilogue: null test-prologue: | Status_Control status; @@ -67,14 +76,14 @@ pre-conditions: states: - name: Zero test-code: | - /* Done by Prepare() */ + /* Done by TQEnqueuePrepareClassicSem() */ text: | - The count of the semaphore shall be zero. + While the count of the semaphore is zero. - name: Positive test-code: | TQSemSetCount( ctx->tq_ctx, 1 ); text: | - The count of the semaphore shall be greater than zero. + While the count of the semaphore is greater than zero. test-epilogue: null test-prologue: null rationale: null @@ -107,8 +116,8 @@ test-local-includes: - tr-tq-enqueue-fifo.h - tr-tq-enqueue-priority.h test-prepare: | - ctx->tq_ctx->base.prepare = Prepare; - ctx->tq_ctx->base.cleanup = Cleanup; + ctx->tq_ctx->base.enqueue_prepare = TQEnqueuePrepareClassicSem; + ctx->tq_ctx->base.enqueue_done = TQSurrenderClassicSem; ctx->tq_ctx->base.get_properties = GetProperties; test-setup: null test-stop: null @@ -120,22 +129,6 @@ test-support: | return TQConvertStatus( &ctx->tq_ctx->base, status ); } - static void Prepare( TQContext *base ) - { - TQSemContext *ctx; - - ctx = (TQSemContext *) base; - TQSemSetCount( ctx, 0 ); - } - - static void Cleanup( TQContext *base ) - { - TQSemContext *ctx; - - ctx = (TQSemContext *) base; - TQSemSetCount( ctx, 1 ); - } - static void GetProperties( TQContext *base, TQWorkerKind enqueued_worker ) { TQSemContext *ctx; |