15 #ifndef CONTEXTSWITCH_H
16 #define CONTEXTSWITCH_H
18 #include "pandabase.h"
19 #include "selectThreadImpl.h"
31 #ifdef THREAD_SIMPLE_IMPL
39 typedef void ContextFunction(
struct ThreadContext *from_context,
void *);
40 typedef void ThreadFunction(
void *);
42 extern const int needs_stack_prealloc;
43 extern const int is_os_threads;
52 void init_thread_context(
struct ThreadContext *context,
53 unsigned char *stack,
size_t stack_size,
54 ThreadFunction *thread_func,
void *data);
59 void save_thread_context(
struct ThreadContext *context,
60 ContextFunction *next_context,
void *data);
67 void switch_to_thread_context(
struct ThreadContext *from_context,
68 struct ThreadContext *to_context);
75 struct ThreadContext *alloc_thread_context();
76 void free_thread_context(
struct ThreadContext *context);