aboutsummaryrefslogtreecommitdiff
path: root/ports
diff options
context:
space:
mode:
authorDavid Lechner2020-01-24 11:37:53 -0600
committerDamien George2020-01-29 17:10:32 +1100
commitb72cb0ca1bb27396a5dcba9ce8a6f00dbd3d5f19 (patch)
treeafba30af029f1aa2775fb0fc135643f549b6b4da /ports
parenta542c6d7e0340e5ff5364426131bdbd69a64e746 (diff)
py/mpthread.h: Use strong type for mp_thread_set_state() argument.
This modifies the signature of mp_thread_set_state() to use mp_state_thread_t* instead of void*. This matches the return type of mp_thread_get_state(), which returns the same value. `struct _mp_state_thread_t;` had to be moved before `#include <mpthreadport.h>` since the stm32 port uses it in its mpthreadport.h file.
Diffstat (limited to 'ports')
-rw-r--r--ports/cc3200/mpthreadport.c2
-rw-r--r--ports/esp32/mpthreadport.c2
-rw-r--r--ports/stm32/mpthreadport.h2
-rw-r--r--ports/unix/mpthreadport.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/ports/cc3200/mpthreadport.c b/ports/cc3200/mpthreadport.c
index 9dbc518e0..f2fc76bdb 100644
--- a/ports/cc3200/mpthreadport.c
+++ b/ports/cc3200/mpthreadport.c
@@ -85,7 +85,7 @@ mp_state_thread_t *mp_thread_get_state(void) {
return pvTaskGetThreadLocalStoragePointer(NULL, 0);
}
-void mp_thread_set_state(void *state) {
+void mp_thread_set_state(mp_state_thread_t *state) {
vTaskSetThreadLocalStoragePointer(NULL, 0, state);
}
diff --git a/ports/esp32/mpthreadport.c b/ports/esp32/mpthreadport.c
index d7db0ff61..febd01a6a 100644
--- a/ports/esp32/mpthreadport.c
+++ b/ports/esp32/mpthreadport.c
@@ -92,7 +92,7 @@ mp_state_thread_t *mp_thread_get_state(void) {
return pvTaskGetThreadLocalStoragePointer(NULL, 1);
}
-void mp_thread_set_state(void *state) {
+void mp_thread_set_state(mp_state_thread_t *state) {
vTaskSetThreadLocalStoragePointer(NULL, 1, state);
}
diff --git a/ports/stm32/mpthreadport.h b/ports/stm32/mpthreadport.h
index 8e2372dcb..e2b39979f 100644
--- a/ports/stm32/mpthreadport.h
+++ b/ports/stm32/mpthreadport.h
@@ -32,7 +32,7 @@ typedef pyb_mutex_t mp_thread_mutex_t;
void mp_thread_init(void);
void mp_thread_gc_others(void);
-static inline void mp_thread_set_state(void *state) {
+static inline void mp_thread_set_state(struct _mp_state_thread_t *state) {
pyb_thread_set_local(state);
}
diff --git a/ports/unix/mpthreadport.c b/ports/unix/mpthreadport.c
index 4fe5fa921..b1915f2a6 100644
--- a/ports/unix/mpthreadport.c
+++ b/ports/unix/mpthreadport.c
@@ -158,7 +158,7 @@ mp_state_thread_t *mp_thread_get_state(void) {
return (mp_state_thread_t*)pthread_getspecific(tls_key);
}
-void mp_thread_set_state(void *state) {
+void mp_thread_set_state(mp_state_thread_t *state) {
pthread_setspecific(tls_key, state);
}