Rev 619 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 619 | Rev 643 | ||
---|---|---|---|
Line 183... | Line 183... | ||
183 | ThreadInfo: PThreadInfo; |
183 | ThreadInfo: PThreadInfo; |
184 | begin |
184 | begin |
185 | if not IsMultiThread then |
185 | if not IsMultiThread then |
186 | begin |
186 | begin |
187 | TLSKey := TLSAlloc(); |
187 | TLSKey := TLSAlloc(); |
188 | InitThreadVars(@SysRelocateThreadVar); {XXX: must be @SysRelocateThreadvar} |
188 | InitThreadVars(@SysRelocateThreadVar); |
189 | IsMultiThread := True; |
189 | IsMultiThread := True; |
190 | end; |
190 | end; |
Line 191... | Line 191... | ||
191 | 191 | ||
192 | StackSize := (StackSize + 3) div 4; |
192 | StackSize := (StackSize + 3) div 4; |
Line 285... | Line 285... | ||
285 | procedure SysRTLEventDestroy(State: PRTLEvent); |
285 | procedure SysRTLEventDestroy(State: PRTLEvent); |
286 | begin |
286 | begin |
287 | end; |
287 | end; |
Line -... | Line 288... | ||
- | 288 | ||
- | 289 | ||
- | 290 | {***************************************************************************** |
|
- | 291 | Heap Mutex Protection |
|
- | 292 | *****************************************************************************} |
|
- | 293 | ||
- | 294 | {$ifndef HAS_MT_MEMORYMANAGER} |
|
- | 295 | var |
|
- | 296 | HeapMutex: TRTLCriticalSection; |
|
- | 297 | ||
- | 298 | procedure KosHeapMutexInit; |
|
- | 299 | begin |
|
- | 300 | InitCriticalSection(HeapMutex); |
|
- | 301 | end; |
|
- | 302 | ||
- | 303 | procedure KosHeapMutexDone; |
|
- | 304 | begin |
|
- | 305 | DoneCriticalSection(HeapMutex); |
|
- | 306 | end; |
|
- | 307 | ||
- | 308 | procedure KosHeapMutexLock; |
|
- | 309 | begin |
|
- | 310 | EnterCriticalSection(HeapMutex); |
|
- | 311 | end; |
|
- | 312 | ||
- | 313 | procedure KosHeapMutexUnlock; |
|
- | 314 | begin |
|
- | 315 | LeaveCriticalSection(HeapMutex); |
|
- | 316 | end; |
|
- | 317 | ||
- | 318 | ||
- | 319 | const |
|
- | 320 | KosMemoryMutexManager: TMemoryMutexManager = ( |
|
- | 321 | MutexInit : @KosHeapMutexInit; |
|
- | 322 | MutexDone : @KosHeapMutexDone; |
|
- | 323 | MutexLock : @KosHeapMutexLock; |
|
- | 324 | MutexUnlock: @KosHeapMutexUnlock); |
|
- | 325 | ||
- | 326 | ||
- | 327 | procedure InitHeapMutexes; |
|
- | 328 | begin |
|
- | 329 | SetMemoryMutexManager(KosMemoryMutexManager); |
|
- | 330 | end; |
|
- | 331 | ||
- | 332 | {$endif HAS_MT_MEMORYMANAGER} |
|
288 | 333 | ||
289 | 334 | ||
Line 290... | Line 335... | ||
290 | var |
335 | var |
291 | KosThreadManager: TThreadManager; |
336 | KosThreadManager: TThreadManager; |
Line 334... | Line 379... | ||
334 | SemaphoreDestroy := @NoSemaphoreDestroy; |
379 | SemaphoreDestroy := @NoSemaphoreDestroy; |
335 | SemaphoreWait := @NoSemaphoreWait; |
380 | SemaphoreWait := @NoSemaphoreWait; |
336 | SemaphorePost := @NoSemaphorePost; |
381 | SemaphorePost := @NoSemaphorePost; |
337 | end; |
382 | end; |
338 | SetThreadManager(KosThreadManager); |
383 | SetThreadManager(KosThreadManager); |
- | 384 | {$ifndef HAS_MT_MEMORYMANAGER} |
|
- | 385 | InitHeapMutexes; |
|
- | 386 | {$endif HAS_MT_MEMORYMANAGER} |
|
339 | ThreadID := GetCurrentThreadID; |
387 | ThreadID := GetCurrentThreadID; |
340 | end;>> |
388 | end;>> |