summaryrefslogtreecommitdiff
path: root/test/tx/regression/threadx_thread_preemption_change_test.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/tx/regression/threadx_thread_preemption_change_test.c')
-rw-r--r--test/tx/regression/threadx_thread_preemption_change_test.c72
1 files changed, 36 insertions, 36 deletions
diff --git a/test/tx/regression/threadx_thread_preemption_change_test.c b/test/tx/regression/threadx_thread_preemption_change_test.c
index 1633ef92..ca0a3c72 100644
--- a/test/tx/regression/threadx_thread_preemption_change_test.c
+++ b/test/tx/regression/threadx_thread_preemption_change_test.c
@@ -51,8 +51,8 @@ CHAR *pointer;
/* Put system definition stuff in here, e.g. thread creates and other assorted
create information. */
- status = tx_thread_create(&thread_0, "thread 0", thread_0_entry, 1,
- pointer, TEST_STACK_SIZE_PRINTF,
+ status = tx_thread_create(&thread_0, "thread 0", thread_0_entry, 1,
+ pointer, TEST_STACK_SIZE_PRINTF,
16, 15, TX_NO_TIME_SLICE, TX_AUTO_START);
pointer = pointer + TEST_STACK_SIZE_PRINTF;
@@ -66,8 +66,8 @@ CHAR *pointer;
#ifndef TX_DISABLE_PREEMPTION_THRESHOLD /* skip this test and pretend it passed */
- status = tx_thread_create(&thread_1, "thread 1", thread_1_entry, 1,
- pointer, TEST_STACK_SIZE_PRINTF,
+ status = tx_thread_create(&thread_1, "thread 1", thread_1_entry, 1,
+ pointer, TEST_STACK_SIZE_PRINTF,
15, 15, TX_NO_TIME_SLICE, TX_AUTO_START);
pointer = pointer + TEST_STACK_SIZE_PRINTF;
@@ -79,8 +79,8 @@ CHAR *pointer;
test_control_return(1);
}
- status = tx_thread_create(&thread_2, "thread 2", thread_2_entry, 1,
- pointer, TEST_STACK_SIZE_PRINTF,
+ status = tx_thread_create(&thread_2, "thread 2", thread_2_entry, 1,
+ pointer, TEST_STACK_SIZE_PRINTF,
14, 14, TX_NO_TIME_SLICE, TX_DONT_START);
pointer = pointer + TEST_STACK_SIZE_PRINTF;
@@ -126,7 +126,7 @@ UINT i;
/* Increment thread 0 counter. */
thread_0_counter++;
- /* Resume thread 1, which has a higher priority. Preemption is disabled
+ /* Resume thread 1, which has a higher priority. Preemption is disabled
though so thread 1 should not run yet. */
status = tx_thread_resume(&thread_1);
@@ -169,7 +169,7 @@ UINT i;
}
/* Change the preemption threshold back to 15. */
- status = tx_thread_preemption_change(&thread_0, 15, &old_threshold);
+ status = tx_thread_preemption_change(&thread_0, 15, &old_threshold);
/* Check status and run counters of other threads. */
if ((status != TX_SUCCESS) || (thread_1_counter != 1) || (thread_2_counter != 0) ||
@@ -181,7 +181,7 @@ UINT i;
test_control_return(1);
}
- /* Resume thread 2. This should preempt because it is priority 14 and the
+ /* Resume thread 2. This should preempt because it is priority 14 and the
current preemption threshold is 15. */
status = tx_thread_resume(&thread_2);
@@ -194,16 +194,16 @@ UINT i;
test_control_return(1);
}
- /* At this point, we are going to loop through preemption changes that result in
+ /* At this point, we are going to loop through preemption changes that result in
preemption. */
for (i = 0; i < (TX_THREAD_EXECUTE_LOG_SIZE*3); i++)
{
/* Change the preemption threshold back to 14. */
- status = tx_thread_preemption_change(&thread_0, 14, &old_threshold);
+ status = tx_thread_preemption_change(&thread_0, 14, &old_threshold);
/* Check status. */
- if (status != TX_SUCCESS)
+ if (status != TX_SUCCESS)
{
/* Thread error. */
@@ -213,7 +213,7 @@ UINT i;
/* Resume thread 2 again. */
status = tx_thread_resume(&thread_2);
-
+
/* Check status an thread 2 run counter. */
if ((status != TX_SUCCESS) && (thread_2_counter != (i+1)))
{
@@ -222,9 +222,9 @@ UINT i;
printf("ERROR #11\n");
test_control_return(1);
}
-
+
/* Change the preemption threshold back to 15 to allow thread 2 to run. */
- status = tx_thread_preemption_change(&thread_0, 15, &old_threshold);
+ status = tx_thread_preemption_change(&thread_0, 15, &old_threshold);
/* Check status an thread 2 run counter. */
if ((status != TX_SUCCESS) && (thread_2_counter != (i+2)))
@@ -237,21 +237,21 @@ UINT i;
}
/* Change the priority of threads 0 and 1. */
- status = tx_thread_priority_change(&thread_0, 7, &old_threshold);
- status += tx_thread_priority_change(&thread_1, 5, &old_threshold);
+ status = tx_thread_priority_change(&thread_0, 7, &old_threshold);
+ status += tx_thread_priority_change(&thread_1, 5, &old_threshold);
/* Check status. */
- if (status != TX_SUCCESS)
+ if (status != TX_SUCCESS)
{
/* Thread error. */
printf("ERROR #13\n");
test_control_return(1);
- }
+ }
/* Change the preemption-threshold of this thread. */
status = tx_thread_preemption_change(&thread_0, 0, &old_threshold);
-
+
/* Check status. */
if ((status != TX_SUCCESS) || (old_threshold != 7))
{
@@ -259,29 +259,29 @@ UINT i;
/* Thread error. */
printf("ERROR #14\n");
test_control_return(1);
- }
-
+ }
+
/* Get the mutex that has priority inheritance. */
status = tx_mutex_get(&mutex_0, TX_WAIT_FOREVER);
/* Check status. */
- if (status != TX_SUCCESS)
+ if (status != TX_SUCCESS)
{
/* Thread error. */
printf("ERROR #15\n");
test_control_return(1);
- }
-
+ }
+
/* Resume thread 1 so that it can suspend on the mutex and automatically raise its priority. */
tx_thread_resume(&thread_1);
-
+
/* Self suspend so that thread 1 and run. */
tx_thread_suspend(&thread_0);
-
+
/* Restore the preemption-threshold of this thread. */
status = tx_thread_preemption_change(&thread_0, old_threshold, &old_threshold);
-
+
/* Check status. */
if ((status != TX_SUCCESS) || (old_threshold != 0) || (thread_0.tx_thread_priority != 5) || (thread_0.tx_thread_preempt_threshold != 5))
{
@@ -289,10 +289,10 @@ UINT i;
/* Thread error. */
printf("ERROR #16\n");
test_control_return(1);
- }
+ }
/* Let thread 1 run again so it can release the mutex and undo the priority inheritance. */
- status = tx_mutex_put(&mutex_0);
+ status = tx_mutex_put(&mutex_0);
/* Check status. */
if ((status != TX_SUCCESS) || (thread_0.tx_thread_priority != 7) || (thread_0.tx_thread_preempt_threshold != 7))
@@ -301,7 +301,7 @@ UINT i;
/* Thread error. */
printf("ERROR #17\n");
test_control_return(1);
- }
+ }
/* Test direct call to the thread preemption change routine with a threshold greater than the current priority. */
status = _tx_thread_preemption_change(&thread_0, 8, &old_threshold);
@@ -313,7 +313,7 @@ UINT i;
/* Thread error. */
printf("ERROR #18\n");
test_control_return(1);
- }
+ }
#endif
@@ -329,7 +329,7 @@ static void thread_1_entry(ULONG thread_input)
/* Self suspend after initial run. */
tx_thread_suspend(&thread_1);
-
+
/* Increment the thread counter. */
thread_1_counter++;
@@ -343,7 +343,7 @@ static void thread_1_entry(ULONG thread_input)
tx_mutex_get(&mutex_0, TX_WAIT_FOREVER);
/* Release the mutex. */
- tx_mutex_put(&mutex_0);
+ tx_mutex_put(&mutex_0);
}
@@ -352,10 +352,10 @@ static void thread_2_entry(ULONG thread_input)
while(1)
{
-
+
/* Increment thread counter. */
thread_2_counter++;
-
+
/* Self suspend. */
tx_thread_suspend(&thread_2);
}