On 11/05/2021 22:07, Gedare Bloom wrote:
I'm not a big fan of the way this has been implemented. It exposes an
internal implementation detail (how you mask the ticks). I don't quite
see why it is being done.

[...]
diff --git a/cpukit/rtems/src/taskwakewhen.c b/cpukit/rtems/src/taskwakewhen.c
index a25204ad01..110debfec2 100644
--- a/cpukit/rtems/src/taskwakewhen.c
+++ b/cpukit/rtems/src/taskwakewhen.c
@@ -27,7 +27,7 @@
  #include <rtems/score/watchdogimpl.h>

  rtems_status_code rtems_task_wake_when(
-  rtems_time_of_day *time_buffer
+  const rtems_time_of_day *time_buffer
  )
  {
    uint32_t          seconds;
@@ -38,11 +38,7 @@ rtems_status_code rtems_task_wake_when(
    if ( !_TOD_Is_set() )
      return RTEMS_NOT_DEFINED;

-  if ( !time_buffer )
-    return RTEMS_INVALID_ADDRESS;
-
-  time_buffer->ticks = 0;
-  status = _TOD_Validate( time_buffer );
+  status = _TOD_Validate( time_buffer, 0 );

The reason for the ticks mask is above. In rtems_task_wake_when(), the ticks member is ignored. Before the change you had a double check for time_buffer == NULL (one in rtems_task_wake_when() and one in _TOD_Validate()). Ignoring the ticks was done with a write to the structure. Now the structure is no longer modified. Using a mask parameter is quite efficient. You just have to load an immediate value and there are no additional branches in _TOD_Validate(). I can add this text to the commit message.

--
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

Reply via email to