Thread/Queue

BlitzMax Forums/BlitzMax Programming/Thread/Queue

How would I pass in a queue (or self-defined type) to a thread as the data object? I have a thread that just constantly checks network communications, and sorts them into queues based on what type they are (coordinates,message,other). Then the other thread is just set to constantly pop off the queue and process the data. For example, how would I pass in TQueue (would I have to do it as a pointer so the other thread can also have access to it?)

Type TQueue
  ...
End Type


Thanks!

CreateThread( threadproc, New TQueue )
Like that?

SuperStrict

Type TQueue
	Method TestQueue()
		Print "Hello"
	End Method
End Type

Function Hello:Object(data:Object)
	data.TestQueue()
End Function

DetachThread(CreateThread(Hello,New TQueue))
Delay 2000


How would I then use the object? The above gives an "Identifier TestQueue() Not Found" error.

SuperStrict

Type TQueue
	Method TestQueue()
		Print "Hello"
	End Method
End Type

Function Hello:Object(data:Object)
	Local queue:TQueue = TQueue(data)
	queue.TestQueue()
End Function

DetachThread(CreateThread(Hello,New TQueue))
Delay 2000

You should probably understand casting and the like before you start fiddling with threads. Just my 2¢.

You should probably understand casting and the like before you start fiddling with threads. Just my 2¢.


I pick it up as I go-- thank you very much for your help!

foosh