mirror of
				https://gitlab.com/freepascal.org/fpc/source.git
				synced 2025-10-31 11:53:42 +01:00 
			
		
		
		
	AThreads: ThreadInfo for the main thread move to a global var to prevent problems with heap manager
This commit is contained in:
		
							parent
							
								
									5fe9ed18d9
								
							
						
					
					
						commit
						1cacbeff1e
					
				| @ -93,6 +93,7 @@ type | |||||||
| 
 | 
 | ||||||
| var | var | ||||||
|   AThreadManager: TThreadManager; |   AThreadManager: TThreadManager; | ||||||
|  |   AThreadMainThreadInfo: TThreadInfo; | ||||||
|   AThreadList: PThreadInfo; |   AThreadList: PThreadInfo; | ||||||
|   AThreadListLen: LongInt; |   AThreadListLen: LongInt; | ||||||
|   AThreadNum: LongInt; |   AThreadNum: LongInt; | ||||||
| @ -404,7 +405,10 @@ begin | |||||||
|       SysDebugLn('FPC AThreads: Entering multithreaded mode...'); |       SysDebugLn('FPC AThreads: Entering multithreaded mode...'); | ||||||
| {$endif} | {$endif} | ||||||
|       p:=PProcess(FindTask(nil)); |       p:=PProcess(FindTask(nil)); | ||||||
|       new(threadInfo); |       { the main thread info is allocated as a global var, it is the cleanest solution, | ||||||
|  |         as it can never really be freed after threading was initialized, due to clashes | ||||||
|  |         with threadvar handling in heap managers, etc. } | ||||||
|  |       threadInfo:=@AThreadMainThreadInfo; | ||||||
|       FillChar(threadInfo^,sizeof(TThreadInfo),0); |       FillChar(threadInfo^,sizeof(TThreadInfo),0); | ||||||
|       p^.pr_Task.tc_UserData:=threadInfo; |       p^.pr_Task.tc_UserData:=threadInfo; | ||||||
|       threadInfo^.mainThread:=true; |       threadInfo^.mainThread:=true; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Marcus Sackrow
						Marcus Sackrow