-
Notifications
You must be signed in to change notification settings - Fork 5
Release/1.1.14 #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Release/1.1.14 #216
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -35,7 +35,6 @@ | |
| #include <algorithm> | ||
| #include <regex> | ||
| #include <limits.h> | ||
| #include <errno.h> | ||
| #include <sys/sysinfo.h> | ||
| #include "ctrlm.h" | ||
| #include "ctrlm_log.h" | ||
|
|
@@ -412,31 +411,8 @@ ctrlm_hal_result_t ctrlm_obj_network_rf4ce_t::hal_init_request(GThread *ctrlm_ma | |
|
|
||
| // Block until initialization is complete or a timeout occurs | ||
| XLOGD_INFO("Waiting for %s initialization...", name_get()); | ||
| struct timespec timeout; | ||
| clock_gettime(CLOCK_REALTIME, &timeout); | ||
| timeout.tv_sec += 2; // this operation should complete in under 100 ms under normal circumstances | ||
|
|
||
| int sem_result = -1; | ||
| do { | ||
| errno = 0; | ||
| sem_result = sem_timedwait(&semaphore_, &timeout); | ||
| if(sem_result == -1 && errno == EINTR) { | ||
| XLOGD_INFO("interrupted"); | ||
| } else { | ||
| break; | ||
| } | ||
| } while(1); | ||
|
|
||
| if(sem_result == -1) { | ||
| if(errno == ETIMEDOUT) { | ||
| XLOGD_ERROR("Timeout waiting for %s initialization", name_get()); | ||
| } else { | ||
| XLOGD_ERROR("Error waiting for %s initialization: %s", name_get(), strerror(errno)); | ||
| } | ||
| init_result_ = CTRLM_HAL_RESULT_ERROR; | ||
| } else { | ||
| sem_destroy(&semaphore_); | ||
| } | ||
| sem_wait(&semaphore_); | ||
| sem_destroy(&semaphore_); | ||
|
Comment on lines
+414
to
+415
|
||
|
|
||
| ready_ = (CTRLM_HAL_RESULT_SUCCESS == init_result_); | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This block no longer enforces a timeout despite the comment saying it does, and sem_wait() can now block indefinitely if the HAL thread never invokes the init confirm callback (e.g., early init failure). Either reintroduce a bounded wait (and propagate a timeout error) or update the init path to guarantee the semaphore is always posted on all failure paths, so ctrlm_main_thread can't deadlock here.