/[guile]/guile/guile-core/libguile/coop-pthreads.h
ViewVC logotype

Diff of /guile/guile-core/libguile/coop-pthreads.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by mvo, Wed Oct 30 10:41:51 2002 UTC revision 1.3 by mvo, Sat Nov 2 01:02:35 2002 UTC
# Line 46  Line 46 
46    
47    
48    
49  /* The coop-pthreads implementation.  We provide implement threads,  /* The coop-pthreads implementation.  We use pthreads for the basic
50     mutices and condition variables using the pthread ones, but only     multi threading stuff, but rig it so that only one thread is ever
51     one thread can ever be active inside Guile at any one time.     active inside Guile.
52  */  */
53    
54  #include <pthread.h>  #include <pthread.h>
# Line 61  Line 61 
61  #define SCM_CRITICAL_SECTION_START  #define SCM_CRITICAL_SECTION_START
62  #define SCM_CRITICAL_SECTION_END  #define SCM_CRITICAL_SECTION_END
63    
64  #define SCM_THREAD_SWITCH_COUNT       50  #define SCM_I_THREAD_SWITCH_COUNT       50
65    
66  #define SCM_THREAD_SWITCHING_CODE \  #define SCM_THREAD_SWITCHING_CODE \
67  do { \  do { \
68    scm_switch_counter--; \    scm_i_switch_counter--; \
69    if (scm_switch_counter == 0) \    if (scm_i_switch_counter == 0) \
70      { \      { \
71        scm_switch_counter = SCM_THREAD_SWITCH_COUNT; \        scm_i_switch_counter = SCM_I_THREAD_SWITCH_COUNT; \
72        scm_yield(); \        scm_yield(); \
73      } \      } \
74  } while (0)  } while (0)
75    
76  SCM_API int scm_switch_counter;  SCM_API int scm_i_switch_counter;
77    
78  #define SCM_THREAD_LOCAL_DATA          (scm_copt_thread_data ())  #define SCM_THREAD_LOCAL_DATA          (scm_i_copt_thread_data)
79  #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))
80    
81  SCM_API void *scm_copt_thread_data (void);  SCM_API void *scm_i_copt_thread_data;
82  SCM_API void scm_copt_set_thread_data (void *);  SCM_API void scm_i_copt_set_thread_data (void *data);
83    
84  #endif  /* SCM_COOP_PTHREAD_H */  #endif  /* SCM_COOP_PTHREAD_H */
85    

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26