/[pcre]/code/trunk/sljit/sljitUtils.c
ViewVC logotype

Diff of /code/trunk/sljit/sljitUtils.c

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

revision 739 by zherczeg, Sat Oct 1 06:42:38 2011 UTC revision 740 by zherczeg, Mon Oct 31 06:10:14 2011 UTC
# Line 58  static SLJIT_INLINE void allocator_relea Line 58  static SLJIT_INLINE void allocator_relea
58    
59  static HANDLE global_mutex = 0;  static HANDLE global_mutex = 0;
60    
61  void SLJIT_CALL sljit_grab_lock(void)  SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_grab_lock(void)
62  {  {
63          /* No idea what to do if an error occures. Static mutexes should never fail... */          /* No idea what to do if an error occures. Static mutexes should never fail... */
64          if (!global_mutex)          if (!global_mutex)
# Line 67  void SLJIT_CALL sljit_grab_lock(void) Line 67  void SLJIT_CALL sljit_grab_lock(void)
67                  WaitForSingleObject(global_mutex, INFINITE);                  WaitForSingleObject(global_mutex, INFINITE);
68  }  }
69    
70  void SLJIT_CALL sljit_release_lock(void)  SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_release_lock(void)
71  {  {
72          ReleaseMutex(global_mutex);          ReleaseMutex(global_mutex);
73  }  }
# Line 98  static SLJIT_INLINE void allocator_relea Line 98  static SLJIT_INLINE void allocator_relea
98    
99  static pthread_mutex_t global_mutex = PTHREAD_MUTEX_INITIALIZER;  static pthread_mutex_t global_mutex = PTHREAD_MUTEX_INITIALIZER;
100    
101  void SLJIT_CALL sljit_grab_lock(void)  SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_grab_lock(void)
102  {  {
103          pthread_mutex_lock(&global_mutex);          pthread_mutex_lock(&global_mutex);
104  }  }
105    
106  void SLJIT_CALL sljit_release_lock(void)  SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_release_lock(void)
107  {  {
108          pthread_mutex_unlock(&global_mutex);          pthread_mutex_unlock(&global_mutex);
109  }  }
# Line 128  void SLJIT_CALL sljit_release_lock(void) Line 128  void SLJIT_CALL sljit_release_lock(void)
128  /* Planning to make it even more clever in the future. */  /* Planning to make it even more clever in the future. */
129  static sljit_w sljit_page_align = 0;  static sljit_w sljit_page_align = 0;
130    
131  struct sljit_stack* SLJIT_CALL sljit_allocate_stack(sljit_w limit, sljit_w max_limit)  SLJIT_API_FUNC_ATTRIBUTE struct sljit_stack* SLJIT_CALL sljit_allocate_stack(sljit_uw limit, sljit_uw max_limit)
132  {  {
133          struct sljit_stack *stack;          struct sljit_stack *stack;
134          union {          union {
# Line 139  struct sljit_stack* SLJIT_CALL sljit_all Line 139  struct sljit_stack* SLJIT_CALL sljit_all
139          SYSTEM_INFO si;          SYSTEM_INFO si;
140  #endif  #endif
141    
142          if (limit > max_limit)          if (limit > max_limit || limit < 1)
143                  return NULL;                  return NULL;
144    
145  #ifdef _WIN32  #ifdef _WIN32
# Line 193  struct sljit_stack* SLJIT_CALL sljit_all Line 193  struct sljit_stack* SLJIT_CALL sljit_all
193    
194  #undef PAGE_ALIGN  #undef PAGE_ALIGN
195    
196  void SLJIT_CALL sljit_free_stack(struct sljit_stack* stack)  SLJIT_API_FUNC_ATTRIBUTE void SLJIT_CALL sljit_free_stack(struct sljit_stack* stack)
197  {  {
198  #ifdef _WIN32  #ifdef _WIN32
199          VirtualFree((void*)stack->base, 0, MEM_RELEASE);          VirtualFree((void*)stack->base, 0, MEM_RELEASE);
# Line 203  void SLJIT_CALL sljit_free_stack(struct Line 203  void SLJIT_CALL sljit_free_stack(struct
203          SLJIT_FREE(stack);          SLJIT_FREE(stack);
204  }  }
205    
206  sljit_w SLJIT_CALL sljit_stack_resize(struct sljit_stack* stack, sljit_uw new_limit)  SLJIT_API_FUNC_ATTRIBUTE sljit_w SLJIT_CALL sljit_stack_resize(struct sljit_stack* stack, sljit_uw new_limit)
207  {  {
208          sljit_uw aligned_old_limit;          sljit_uw aligned_old_limit;
209          sljit_uw aligned_new_limit;          sljit_uw aligned_new_limit;

Legend:
Removed from v.739  
changed lines
  Added in v.740

  ViewVC Help
Powered by ViewVC 1.1.5