Changeset 762
- Timestamp:
- 06/25/08 13:03:09 (2 months ago)
- Files:
-
- trunk/phobos/std/thread.d (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/phobos/std/thread.d
r749 r762 31 31 * It is important to use the $(B Thread) class to create and manage 32 32 * threads as the garbage collector needs to know about all the threads. 33 * 34 * Authors: Walter Bright, Bartosz Milewski 35 * 33 36 * Macros: 34 37 * WIKI=Phobos/StdThread … … 400 403 static uint nthreads = 1; 401 404 static __thread uint myCompactThreadId; // 11-bit ((idx << 1) | 1) 405 enum uint TID_BITS = 11; 402 406 403 407 private: 404 408 405 409 static uint allThreadsDim; 406 static Thread[0x400] allThreads; // length matches value in C runtime 410 enum uint MAX_THREADS = (1 << (TID_BITS - 1)); // 0x400 411 static Thread[MAX_THREADS] allThreads; // length matches value in C runtime 412 static assert(MAX_THREADS == 0x400); 407 413 408 414 TS state; … … 921 927 static uint nthreads = 1; 922 928 static __thread uint myCompactThreadId; // 11-bit ((idx << 1) | 1) 929 enum uint TID_BITS = 11; 923 930 924 931 private: … … 929 936 // pthread_create will fail gracefully if stack limit 930 937 // is reached prior to allThreads max. 931 static Thread[0x400] allThreads; 938 enum uint MAX_THREADS = (1 << (TID_BITS - 1)); // 0x400 939 static Thread[MAX_THREADS] allThreads; 940 static assert(MAX_THREADS == 0x400); 932 941 933 942 static sem_t flagSuspend;
