TList - A Win32 Multithreaded stack killer

Archives Forums/BlitzMax Bug Reports/TList - A Win32 Multithreaded stack killer

matibee(Posted 2013) [#1]
SuperStrict 

Type thing
	Field vals:Float[12]
	
	Function Create:thing()
		Local a:thing = New thing
		Return a
	End function
End type

Local biglist:TList = New TList

For Local a:Int = 0 To 150000 - 1
	Local t:thing = thing.Create()
	biglist.addlast( t )
	If ( a Mod 1000 = 0 ) Print a
Next

Print "done!"


This is taken from the main Blitzmax thread but I'm fairly sure there must be a bug somewhere in the TList handling of insertion that causes it to stack-overflow.


col(Posted 2013) [#2]
Hiya matibee,

In the meantime, I'm not sure if its any use for you as an alternative - I worked out some completely multithread safe TStack and TQueue routines. You could 'walk' the stack and queue but only in the 'top-down' direction if needed.


matibee(Posted 2013) [#3]
Hi col,

That's really interesting and I don't know how I missed it at the time.

I don't actually need thread-safe TLists (for now at least!) so I managed to write more of a dynamic array structure with simple iterator access for top down walking, addlast and remove(from any position.)

Anyway thanks a lot for the link and the code. Really interesting stuff!