Skip to content
Snippets Groups Projects
Commit 9172c0cb authored by Damien George's avatar Damien George
Browse files

py/modthread: Call mp_thread_start/mp_thread_finish around threads.

So the underlying thread implementation can do any necessary bookkeeping.
parent 722cff5f
No related branches found
No related tags found
No related merge requests found
......@@ -154,6 +154,9 @@ STATIC void *thread_entry(void *args_in) {
mp_stack_set_top(&ts + 1); // need to include ts in root-pointer scan
mp_stack_set_limit(16 * 1024); // fixed stack limit for now
// signal that we are set up and running
mp_thread_start();
// TODO set more thread-specific state here:
// mp_pending_exception? (root pointer)
// cur_exception (root pointer)
......@@ -182,6 +185,9 @@ STATIC void *thread_entry(void *args_in) {
DEBUG_printf("[thread] finish ts=%p\n", &ts);
// signal that we are finished
mp_thread_finish();
return NULL;
}
......
......@@ -41,6 +41,8 @@ struct _mp_state_thread_t;
struct _mp_state_thread_t *mp_thread_get_state(void);
void mp_thread_set_state(void *state);
void mp_thread_create(void *(*entry)(void*), void *arg, size_t stack_size);
void mp_thread_start(void);
void mp_thread_finish(void);
void mp_thread_mutex_init(mp_thread_mutex_t *mutex);
int mp_thread_mutex_lock(mp_thread_mutex_t *mutex, int wait);
void mp_thread_mutex_unlock(mp_thread_mutex_t *mutex);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment