Basic threads

BlitzMax Forums/BlitzMax Beginners Area/Basic threads

JBR(Posted 2009) [#1]
Is the following code correctly threading. I would have liked to call the threads with an integer but I had to make a type instead.
Is there anyway I could have just supplied an integer?

SuperStrict

Type times
	Field i:Int
End Type

Function do_some_loops:Object( i:Object )

	Local j:Int

	For j=1 To times(i).i
	Next


End Function





Local s:times = New times
	s.i = 100000000
Local t:times = New times
	t.i = 100000000


Delay(2000)



Local time:Int = MilliSecs()

Local Thread1:Int = CreateThread(do_some_loops,s:times)
Local Thread2:Int = CreateThread(do_some_loops,t:times)

WaitThread( Thread1 )
WaitThread( Thread2 )

time=MilliSecs()-time


Print time

WaitKey()
End



Otus(Posted 2009) [#2]
You could cast an Int to a String or wrap it in an array like [10000], but neither is much better than a type, I guess.