From 198d3c10de5427fcd27e2d2a7577113403d2b130 Mon Sep 17 00:00:00 2001 From: erling Date: Fri, 10 Nov 2023 22:24:22 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Edward A. Lee --- core/tag.c | 2 +- include/core/reactor.h | 29 ++++++++++++++++------------- 2 files changed, 17 insertions(+), 14 deletions(-) diff --git a/core/tag.c b/core/tag.c index aabeab630..0fe48817d 100644 --- a/core/tag.c +++ b/core/tag.c @@ -134,7 +134,7 @@ int lf_tag_compare(tag_t tag1, tag_t tag2) { tag_t lf_delay_tag(tag_t tag, interval_t interval) { if (tag.time == NEVER || interval < 0LL) return tag; - if (tag.time == FOREVER && tag.microstep == FOREVER_MICROSTEP) return tag; + if (tag.time >= FOREVER - interval) return tag; tag_t result = tag; if (interval == 0LL) { // Note that unsigned variables will wrap on overflow. diff --git a/include/core/reactor.h b/include/core/reactor.h index e1d491914..0e56c0f3e 100644 --- a/include/core/reactor.h +++ b/include/core/reactor.h @@ -419,32 +419,35 @@ void _lf_initialize_watchdog_mutexes(void); /** - * @brief Retrives the enclave ids of the direct upstream enclaves. - * The implementation is code-generated. + * @brief Get the array of ids of enclaves directly upstream of the specified enclave. + * This updates the specified result pointer to point to a statically allocated array of IDs + * and returns the length of the array. The implementation is code-generated. * - * @param enclave_id The enclave for which to search for direct upstream - * @param result This pointer is dereferenced and pointed to the resulting array. - * @return int The number of direct upstreams. + * @param enclave_id The enclave for which to report upstream IDs. + * @param result The pointer to dereference and update to point to the resulting array. + * @return The number of direct upstream enclaves. */ int _lf_get_upstream_of(int enclave_id, int** result); /** - * @brief Retrives the enclave ids of the direct downstream enclaves. - * The implementation is code-generated. + * @brief Get the array of ids of enclaves directly downstream of the specified enclave. + * This updates the specified result pointer to point to a statically allocated array of IDs + * and returns the length of the array. The implementation is code-generated. * - * @param enclave_id The enclave for which to search for direct downstream. - * @param result This pointer is dereferenced and pointed to the resulting array. - * @return int The number of direct downstream. + * @param enclave_id The enclave for which to report downstream IDs. + * @param result The pointer to dereference and update to point to the resulting array. + * @return The number of direct downstream enclaves. */ int _lf_get_downstream_of(int enclave_id, int** result); /** - * @brief Retrives the delays on the connections to the direct upstream enclaves. + * @brief Retrive the delays on the connections to direct upstream enclaves. + * This updates the result pointer to point to a statically allocated array of delays. * The implementation is code-generated. * * @param enclave_id The enclave for which to search for upstream delays. - * @param result This pointer is dereferenced and pointed to the resulting array. - * @return int The number of direct upstreams. + * @param result The pointer to dereference and update to point to the resulting array. + * @return int The number of direct upstream enclaves. */ int _lf_get_upstream_delay_of(int enclave_id, interval_t** result);