소스 검색

Added definition for threaded variables.

Brucey 4 년 전
부모
커밋
16f0976da8
2개의 변경된 파일8개의 추가작업 그리고 0개의 파일을 삭제
  1. 6 0
      blitz.mod/blitz.bmx
  2. 2 0
      blitz.mod/blitz_thread.h

+ 6 - 0
blitz.mod/blitz.bmx

@@ -871,6 +871,12 @@ bbdoc: Declare a global variable
 keyword: "Global"
 End Rem
 
+Rem
+bbdoc: Declare a threaded global variable
+about: Each thread will have its own copy of the variable - any changes to the variable will be visible only within the thread the change was made.
+keyword: "ThreadedGlobal"
+End Rem
+
 Rem
 bbdoc: Declare a field variable
 keyword: "Field"

+ 2 - 0
blitz.mod/blitz_thread.h

@@ -149,6 +149,8 @@ extern bb_mutex_t _bbLock;
 #define BB_LOCK if( _bbNeedsLock ){ bb_mutex_lock( &_bbLock ); }
 #define BB_UNLOCK if( _bbNeedsLock ){ bb_mutex_unlock( &_bbLock ); }
 
+#define BBThreadLocal __thread
+
 #ifdef __cplusplus
 }
 #endif