mirror of
https://gitlab.rtems.org/rtems/rtos/rtems.git
synced 2025-12-05 23:23:13 +00:00
+ Moved error checks to before the dispatch disable where possible.
+ Modified correct return path to call _ITRON_return_errorno( E_OK ) instead of enabling dispatching and returning E_OK.
This commit is contained in:
@@ -31,18 +31,12 @@ ER cre_tsk(
|
|||||||
boolean status;
|
boolean status;
|
||||||
Priority_Control core_priority;
|
Priority_Control core_priority;
|
||||||
|
|
||||||
/*
|
|
||||||
* Disable dispatching.
|
|
||||||
*/
|
|
||||||
|
|
||||||
_Thread_Disable_dispatch();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validate Parameters.
|
* Validate Parameters.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( pk_ctsk == NULL )
|
if ( pk_ctsk == NULL )
|
||||||
_ITRON_return_errorno( E_PAR );
|
return E_PAR;
|
||||||
|
|
||||||
if ((pk_ctsk->tskatr != TA_ASM ) &&
|
if ((pk_ctsk->tskatr != TA_ASM ) &&
|
||||||
(pk_ctsk->tskatr != TA_HLNG) &&
|
(pk_ctsk->tskatr != TA_HLNG) &&
|
||||||
@@ -54,14 +48,20 @@ ER cre_tsk(
|
|||||||
(pk_ctsk->tskatr != TA_COP5) &&
|
(pk_ctsk->tskatr != TA_COP5) &&
|
||||||
(pk_ctsk->tskatr != TA_COP6) &&
|
(pk_ctsk->tskatr != TA_COP6) &&
|
||||||
(pk_ctsk->tskatr != TA_COP7))
|
(pk_ctsk->tskatr != TA_COP7))
|
||||||
_ITRON_return_errorno( E_RSATR );
|
return E_RSATR;
|
||||||
|
|
||||||
if (( pk_ctsk->itskpri <= 0 ) || ( pk_ctsk->itskpri >= 256 ))
|
if (( pk_ctsk->itskpri <= 0 ) || ( pk_ctsk->itskpri >= 256 ))
|
||||||
_ITRON_return_errorno( E_PAR );
|
return E_PAR;
|
||||||
if ( pk_ctsk->task == NULL )
|
if ( pk_ctsk->task == NULL )
|
||||||
_ITRON_return_errorno( E_PAR );
|
return E_PAR;
|
||||||
if ( pk_ctsk->stksz < 0 )
|
if ( pk_ctsk->stksz < 0 )
|
||||||
_ITRON_return_errorno( E_PAR );
|
return E_PAR;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Disable dispatching.
|
||||||
|
*/
|
||||||
|
|
||||||
|
_Thread_Disable_dispatch();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* allocate the thread.
|
* allocate the thread.
|
||||||
@@ -106,8 +106,7 @@ ER cre_tsk(
|
|||||||
|
|
||||||
the_thread->Start.entry_point = (Thread_Entry) pk_ctsk->task;
|
the_thread->Start.entry_point = (Thread_Entry) pk_ctsk->task;
|
||||||
|
|
||||||
_Thread_Enable_dispatch();
|
_ITRON_return_errorno( E_OK );
|
||||||
return E_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -31,18 +31,12 @@ ER cre_tsk(
|
|||||||
boolean status;
|
boolean status;
|
||||||
Priority_Control core_priority;
|
Priority_Control core_priority;
|
||||||
|
|
||||||
/*
|
|
||||||
* Disable dispatching.
|
|
||||||
*/
|
|
||||||
|
|
||||||
_Thread_Disable_dispatch();
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Validate Parameters.
|
* Validate Parameters.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ( pk_ctsk == NULL )
|
if ( pk_ctsk == NULL )
|
||||||
_ITRON_return_errorno( E_PAR );
|
return E_PAR;
|
||||||
|
|
||||||
if ((pk_ctsk->tskatr != TA_ASM ) &&
|
if ((pk_ctsk->tskatr != TA_ASM ) &&
|
||||||
(pk_ctsk->tskatr != TA_HLNG) &&
|
(pk_ctsk->tskatr != TA_HLNG) &&
|
||||||
@@ -54,14 +48,20 @@ ER cre_tsk(
|
|||||||
(pk_ctsk->tskatr != TA_COP5) &&
|
(pk_ctsk->tskatr != TA_COP5) &&
|
||||||
(pk_ctsk->tskatr != TA_COP6) &&
|
(pk_ctsk->tskatr != TA_COP6) &&
|
||||||
(pk_ctsk->tskatr != TA_COP7))
|
(pk_ctsk->tskatr != TA_COP7))
|
||||||
_ITRON_return_errorno( E_RSATR );
|
return E_RSATR;
|
||||||
|
|
||||||
if (( pk_ctsk->itskpri <= 0 ) || ( pk_ctsk->itskpri >= 256 ))
|
if (( pk_ctsk->itskpri <= 0 ) || ( pk_ctsk->itskpri >= 256 ))
|
||||||
_ITRON_return_errorno( E_PAR );
|
return E_PAR;
|
||||||
if ( pk_ctsk->task == NULL )
|
if ( pk_ctsk->task == NULL )
|
||||||
_ITRON_return_errorno( E_PAR );
|
return E_PAR;
|
||||||
if ( pk_ctsk->stksz < 0 )
|
if ( pk_ctsk->stksz < 0 )
|
||||||
_ITRON_return_errorno( E_PAR );
|
return E_PAR;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Disable dispatching.
|
||||||
|
*/
|
||||||
|
|
||||||
|
_Thread_Disable_dispatch();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* allocate the thread.
|
* allocate the thread.
|
||||||
@@ -106,8 +106,7 @@ ER cre_tsk(
|
|||||||
|
|
||||||
the_thread->Start.entry_point = (Thread_Entry) pk_ctsk->task;
|
the_thread->Start.entry_point = (Thread_Entry) pk_ctsk->task;
|
||||||
|
|
||||||
_Thread_Enable_dispatch();
|
_ITRON_return_errorno( E_OK );
|
||||||
return E_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user