Skip to content

Commit

Permalink
Fix z_task cleanup for platforms with pthread support (#759)
Browse files Browse the repository at this point in the history
  • Loading branch information
sashacmc authored Oct 22, 2024
1 parent 8aa53e2 commit fe105a9
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 15 deletions.
6 changes: 1 addition & 5 deletions src/system/emscripten/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,7 @@ z_result_t _z_task_detach(_z_task_t *task) { _Z_CHECK_SYS_ERR(pthread_detach(*ta

z_result_t _z_task_cancel(_z_task_t *task) { _Z_CHECK_SYS_ERR(pthread_cancel(*task)); }

void _z_task_free(_z_task_t **task) {
_z_task_t *ptr = *task;
z_free(ptr);
*task = NULL;
}
void _z_task_free(_z_task_t **task) { *task = NULL; }

/*------------------ Mutex ------------------*/
z_result_t _z_mutex_init(_z_mutex_t *m) { _Z_CHECK_SYS_ERR(pthread_mutex_init(m, 0)); }
Expand Down
6 changes: 1 addition & 5 deletions src/system/unix/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,7 @@ z_result_t _z_task_detach(_z_task_t *task) { _Z_CHECK_SYS_ERR(pthread_detach(*ta

z_result_t _z_task_cancel(_z_task_t *task) { _Z_CHECK_SYS_ERR(pthread_cancel(*task)); }

void _z_task_free(_z_task_t **task) {
_z_task_t *ptr = *task;
z_free(ptr);
*task = NULL;
}
void _z_task_free(_z_task_t **task) { *task = NULL; }

/*------------------ Mutex ------------------*/
z_result_t _z_mutex_init(_z_mutex_t *m) { _Z_CHECK_SYS_ERR(pthread_mutex_init(m, 0)); }
Expand Down
6 changes: 1 addition & 5 deletions src/system/zephyr/system.c
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,7 @@ z_result_t _z_task_detach(_z_task_t *task) { _Z_CHECK_SYS_ERR(pthread_detach(*ta

z_result_t _z_task_cancel(_z_task_t *task) { _Z_CHECK_SYS_ERR(pthread_cancel(*task)); }

void _z_task_free(_z_task_t **task) {
_z_task_t *ptr = *task;
z_free(ptr);
*task = NULL;
}
void _z_task_free(_z_task_t **task) { *task = NULL; }

/*------------------ Mutex ------------------*/
z_result_t _z_mutex_init(_z_mutex_t *m) { _Z_CHECK_SYS_ERR(pthread_mutex_init(m, 0)); }
Expand Down

0 comments on commit fe105a9

Please sign in to comment.