Re: [PATCH] score: Document thread queue operations

2021-09-02 Thread Chris Johns
On 2/9/21 5:09 pm, Sebastian Huber wrote:
> Hello Chris,
> 
> thanks for the review, I will send a v2 of the patch.
> 
> On 02/09/2021 08:38, Chris Johns wrote:
>>>  */
>>>     Thread_queue_Enqueue_operation enqueue;
>>>       /**
>>> -   * @brief Thread queue extract operation.
>>> +   * @brief This operation is used to extract the thread from the thread 
>>> queue.
>>>  *
>>> -   * Called by object routines to extract a thread from a thread queue.
>>> +   * The extract operation is intended for timeouts, thread restarts, and
>>> +   * thread cancellation.  The surrender operation should be used to 
>>> dequeue a
>>> +   * thread from the thread queue.
>>  From the start, end, or where it is in the queue?
>>
> 
> I think this is clear:
> 
> "This operation is used to extract the thread from the thread queue."
> 
> A thread is extracted. It doesn't matter at which position it is.

It may if you know the signature. I do not know the signature nor does it say.
As a result I question it being "clear".

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] score: Document thread queue operations

2021-09-02 Thread Sebastian Huber

Hello Chris,

thanks for the review, I will send a v2 of the patch.

On 02/09/2021 08:38, Chris Johns wrote:

 */
Thread_queue_Enqueue_operation enqueue;
  
/**

-   * @brief Thread queue extract operation.
+   * @brief This operation is used to extract the thread from the thread queue.
 *
-   * Called by object routines to extract a thread from a thread queue.
+   * The extract operation is intended for timeouts, thread restarts, and
+   * thread cancellation.  The surrender operation should be used to dequeue a
+   * thread from the thread queue.

 From the start, end, or where it is in the queue?



I think this is clear:

"This operation is used to extract the thread from the thread queue."

A thread is extracted. It doesn't matter at which position it is.

--
embedded brains GmbH
Herr Sebastian HUBER
Dornierstr. 4
82178 Puchheim
Germany
email: sebastian.hu...@embedded-brains.de
phone: +49-89-18 94 741 - 16
fax:   +49-89-18 94 741 - 08

Registergericht: Amtsgericht München
Registernummer: HRB 157899
Vertretungsberechtigte Geschäftsführer: Peter Rasmussen, Thomas Dörfler
Unsere Datenschutzerklärung finden Sie hier:
https://embedded-brains.de/datenschutzerklaerung/
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Re: [PATCH] score: Document thread queue operations

2021-09-02 Thread Chris Johns
On 2/9/21 3:50 pm, Sebastian Huber wrote:
> ---
>  cpukit/include/rtems/score/threadq.h | 44 ++--
>  cpukit/include/rtems/score/threadqimpl.h | 17 +
>  2 files changed, 51 insertions(+), 10 deletions(-)
> 
> diff --git a/cpukit/include/rtems/score/threadq.h 
> b/cpukit/include/rtems/score/threadq.h
> index 10476888d4..0362f84c98 100644
> --- a/cpukit/include/rtems/score/threadq.h
> +++ b/cpukit/include/rtems/score/threadq.h
> @@ -406,6 +406,7 @@ typedef struct _Thread_queue_Heads {
>  } Thread_queue_Heads;
>  
>  struct Thread_queue_Queue {
> +#if defined(RTEMS_SMP)
>/**
> * @brief Lock to protect this thread queue.
> *
> @@ -418,7 +419,6 @@ struct Thread_queue_Queue {
> * @see _Thread_queue_Acquire(), _Thread_queue_Acquire_critical() and
> * _Thread_queue_Release().
> */
> -#if defined(RTEMS_SMP)
>SMP_ticket_lock_Control Lock;
>  #endif
>  
> @@ -517,37 +517,61 @@ typedef Thread_Control *( *Thread_queue_First_operation 
> )(
>  );
>  
>  /**
> - * @brief Thread queue operations.
> + * @brief The thread queue operations are used to implement the addition and
> + *   removal of threads to and from a thread queue and related tasks.

Addition and removal? Is there something better, insert and extract?

> + *
> + * The standard thread queue operation variants are:
> + *
> + * * ::_Thread_queue_Operations_default
> + *
> + * * ::_Thread_queue_Operations_FIFO
> + *
> + * * ::_Thread_queue_Operations_priority
> + *
> + * * ::_Thread_queue_Operations_priority_inherit
>   *
>   * @see _Thread_wait_Set_operations().
>   */
>  struct Thread_queue_Operations {
>/**
> -   * @brief Thread queue priority actions operation.
> +   * @brief This operation performs the thread queue priority actions.
> +   *
> +   * Priority actions are produced and processed during enqueue, extract, and
> +   * surrender operations.
> */
>Thread_queue_Priority_actions_operation priority_actions;
>  
>/**
> -   * @brief Thread queue enqueue operation.
> -   *
> -   * Called by object routines to enqueue the thread.
> +   * @brief This operation is used to enqueue the thread on the thread queue.

Where in the queue is the thread inserted?

> */
>Thread_queue_Enqueue_operation enqueue;
>  
>/**
> -   * @brief Thread queue extract operation.
> +   * @brief This operation is used to extract the thread from the thread 
> queue.
> *
> -   * Called by object routines to extract a thread from a thread queue.
> +   * The extract operation is intended for timeouts, thread restarts, and
> +   * thread cancellation.  The surrender operation should be used to dequeue 
> a
> +   * thread from the thread queue.

>From the start, end, or where it is in the queue?

> */
>Thread_queue_Extract_operation extract;
>  
>/**
> -   * @brief Thread queue surrender operation.
> +   * @brief This operation is used to dequeue the thread from the thread 
> queue
> +   *   and optionally surrender the thread queue from a previous owner.
> +   *
> +   * In addition to the optional surrender, there is a subtle difference
> +   * between the extract and dequeue of a thread from a thread queue.  In SMP
> +   * configurations, FIFO fairness across schedulers for priority queues is
> +   * only ensured for the dequeue operation and not for the extract 
> operation.

Dequeue or extract? There seems to be a mix of terms and I am not 100% if they
are the same or different? There is addition, enqueue, removal, dequeue, 
extract.

I have read the statement about the difference between dequeue and extract and I
am not sure what it means.

> */
>Thread_queue_Surrender_operation surrender;
>  
>/**
> -   * @brief Thread queue first operation.
> +   * @brief This operation returns the first thread on the thread queue.
> +   *
> +   * This operation shall be called only when the thread queue contains at
> +   * least one thread.  Use ::Thread_queue_Queue::heads to determine if a
> +   * thread queue is empty.

Shall? It is implies this call "shall" be made for every call?

> */
>Thread_queue_First_operation first;
>  };
> diff --git a/cpukit/include/rtems/score/threadqimpl.h 
> b/cpukit/include/rtems/score/threadqimpl.h
> index 33cdb3058d..5d3edaf9e0 100644
> --- a/cpukit/include/rtems/score/threadqimpl.h
> +++ b/cpukit/include/rtems/score/threadqimpl.h
> @@ -1396,12 +1396,29 @@ typedef struct {
>  Wait_queue.Queue \
>)
>  
> +/**
> + * @brief The default thread queue operations are used when a thread is not
> + *   enqueued on a thread queue.

What is the default set of operations compared to the operations below?

Chris
___
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel