[PATCH 04/17] score: Add thread actions
Sebastian Huber
sebastian.huber at embedded-brains.de
Tue Mar 25 15:41:53 UTC 2014
On 2014-03-25 16:36, Gedare Bloom wrote:
> On Tue, Mar 25, 2014 at 8:49 AM, Sebastian Huber
> <sebastian.huber at embedded-brains.de> wrote:
>> Thread actions are the building block for efficient implementation of
>> - Classic signals delivery,
>> - POSIX signals delivery,
>> - thread restart notification,
>> - thread delete notification,
>> - forced thread migration on SMP configurations, and
>> - the Multiprocessor Resource Sharing Protocol (MrsP).
>> ---
>> cpukit/score/include/rtems/score/thread.h | 59 ++++++++++++++++++++++
>> cpukit/score/include/rtems/score/threadimpl.h | 67 +++++++++++++++++++++++++
>> cpukit/score/src/threaddispatch.c | 33 ++++++++++++
>> cpukit/score/src/threadinitialize.c | 2 +
>> 4 files changed, 161 insertions(+), 0 deletions(-)
>>
>> diff --git a/cpukit/score/include/rtems/score/thread.h b/cpukit/score/include/rtems/score/thread.h
>> index 7147110..153537a 100644
>> --- a/cpukit/score/include/rtems/score/thread.h
>> +++ b/cpukit/score/include/rtems/score/thread.h
>> @@ -356,6 +356,62 @@ typedef enum {
>> /** This macro defines the last API which has threads. */
>> #define THREAD_API_LAST THREAD_API_POSIX
>>
>> +typedef struct Thread_Action Thread_Action;
>> +
>> +/**
>> + * @brief Thread action handler.
>> + *
>> + * The thread action handler will be called with interrupts disabled and the
>> + * thread action lock acquired. The handler must release the thread action
>> + * lock with _Thread_Action_release_and_ISR_enable(). So the thread action
>> + * lock can be used to protect private data fields of the particular action.
>> + *
> Why doesn't the caller of the handler release the lock and enable ISRs
> after the handler returns?
The handler may do complex things. The thread terminate and restart extensions
are called by such a handler. They can do all sorts of stuff including
blocking on a semaphore, IO operations, etc.
[...]
>> +RTEMS_INLINE_ROUTINE Per_CPU_Control *
>> + _Thread_Action_ISR_disable_and_acquire_for_executing( ISR_Level *level )
>> +{
>> + Per_CPU_Control *cpu;
>> +
>> + _ISR_Disable_without_giant( *level );
>> + cpu = _Per_CPU_Get();
>> + _Per_CPU_Acquire( cpu );
>> +
>> + return cpu;
>> +}
> Is this "for_executing" variant required for some SMP uses? On non-smp
> it is the same the next function. I do not see the function is used in
> this patch.
Its used in patch 14 (this is the main patch).
[...]
--
Sebastian Huber, embedded brains GmbH
Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone : +49 89 189 47 41-16
Fax : +49 89 189 47 41-09
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the devel
mailing list