You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mynewt.apache.org by je...@apache.org on 2020/12/12 12:03:03 UTC

[mynewt-core] 02/02: net/ip/native_socks: Defunct tick based time in syscfg

This is an automated email from the ASF dual-hosted git repository.

jerzy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/mynewt-core.git

commit 72bd05daf78115a79641ad073828abf77d8b08af
Author: Jerzy Kasenberg <je...@codecoup.pl>
AuthorDate: Thu Dec 10 10:32:54 2020 +0100

    net/ip/native_socks: Defunct tick based time in syscfg
    
    NATIVE_SOCKETS_POLL_ITVL time interval values was using ticks as unit.
    Default value had expression involving OS_TICKS_PER_SEC that clearly
    indicated that time were meant to be expressed in real time instead of
    build specific ticks.
    
    This introduces NATIVE_SOCKETS_POLL_INTERVAL_MS equivalent syscfg value
    defined in ms, and defunct old NATIVE_SOCKETS_POLL_ITVL.
    
    Resulting code should stay the same since computation will
    be done during compilation as before.
---
 net/ip/native_sockets/src/native_sock.c | 2 +-
 net/ip/native_sockets/syscfg.yml        | 8 ++++++--
 2 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/net/ip/native_sockets/src/native_sock.c b/net/ip/native_sockets/src/native_sock.c
index 1c1b802..5fbf0d1 100644
--- a/net/ip/native_sockets/src/native_sock.c
+++ b/net/ip/native_sockets/src/native_sock.c
@@ -754,7 +754,7 @@ socket_task(void *arg)
     os_mutex_pend(&nss->mtx, OS_WAIT_FOREVER);
     while (1) {
         os_mutex_release(&nss->mtx);
-        os_time_delay(MYNEWT_VAL(NATIVE_SOCKETS_POLL_ITVL));
+        os_time_delay(os_time_ms_to_ticks32(MYNEWT_VAL(NATIVE_SOCKETS_POLL_INTERVAL_MS)));
         os_mutex_pend(&nss->mtx, OS_WAIT_FOREVER);
         if (nss->poll_fd_cnt) {
             rc = poll(nss->poll_fds, nss->poll_fd_cnt, 0);
diff --git a/net/ip/native_sockets/syscfg.yml b/net/ip/native_sockets/syscfg.yml
index aceb333..df82b59 100644
--- a/net/ip/native_sockets/syscfg.yml
+++ b/net/ip/native_sockets/syscfg.yml
@@ -24,10 +24,14 @@ syscfg.defs:
         description: 'The maximum UDP datagram size (send and receive).'
         value: 2048
     NATIVE_SOCKETS_POLL_ITVL:
+        description: Use NATIVE_SOCKETS_POLL_INTERVAL instead.
+        defunct: 1
+        value:
+    NATIVE_SOCKETS_POLL_INTERVAL_MS:
         description: >
             The frequency at which to poll for received data.  Units
-            are OS ticks.
-        value: 'OS_TICKS_PER_SEC / 5'
+            are ms.
+        value: 200
     NATIVE_SOCKETS_STACK_SZ:
         description: 'The size of the native sockets task stack, in bytes.'
         value: 4096