mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-12 14:50:19 +02:00
Redone completely, you might start testing it now.
This commit is contained in:
parent
cfe062d097
commit
0019d6a19d
2 changed files with 542 additions and 370 deletions
File diff suppressed because it is too large
Load diff
|
@ -46,9 +46,9 @@
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* The coop-pthreads implementation. We provide implement threads,
|
/* The coop-pthreads implementation. We use pthreads for the basic
|
||||||
mutices and condition variables using the pthread ones, but only
|
multi threading stuff, but rig it so that only one thread is ever
|
||||||
one thread can ever be active inside Guile at any one time.
|
active inside Guile.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
@ -61,25 +61,25 @@
|
||||||
#define SCM_CRITICAL_SECTION_START
|
#define SCM_CRITICAL_SECTION_START
|
||||||
#define SCM_CRITICAL_SECTION_END
|
#define SCM_CRITICAL_SECTION_END
|
||||||
|
|
||||||
#define SCM_THREAD_SWITCH_COUNT 50
|
#define SCM_I_THREAD_SWITCH_COUNT 50
|
||||||
|
|
||||||
#define SCM_THREAD_SWITCHING_CODE \
|
#define SCM_THREAD_SWITCHING_CODE \
|
||||||
do { \
|
do { \
|
||||||
scm_switch_counter--; \
|
scm_i_switch_counter--; \
|
||||||
if (scm_switch_counter == 0) \
|
if (scm_i_switch_counter == 0) \
|
||||||
{ \
|
{ \
|
||||||
scm_switch_counter = SCM_THREAD_SWITCH_COUNT; \
|
scm_i_switch_counter = SCM_I_THREAD_SWITCH_COUNT; \
|
||||||
scm_yield(); \
|
scm_yield(); \
|
||||||
} \
|
} \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
SCM_API int scm_switch_counter;
|
SCM_API int scm_i_switch_counter;
|
||||||
|
|
||||||
#define SCM_THREAD_LOCAL_DATA (scm_copt_thread_data ())
|
#define SCM_THREAD_LOCAL_DATA (scm_i_copt_thread_data)
|
||||||
#define SCM_SET_THREAD_LOCAL_DATA(ptr) (scm_copt_set_thread_data (ptr))
|
#define SCM_SET_THREAD_LOCAL_DATA(ptr) (scm_i_copt_set_thread_data (ptr))
|
||||||
|
|
||||||
SCM_API void *scm_copt_thread_data (void);
|
SCM_API void *scm_i_copt_thread_data;
|
||||||
SCM_API void scm_copt_set_thread_data (void *);
|
SCM_API void scm_i_copt_set_thread_data (void *data);
|
||||||
|
|
||||||
#endif /* SCM_COOP_PTHREAD_H */
|
#endif /* SCM_COOP_PTHREAD_H */
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue