Making a callback thread safe

BlitzMax Forums/BlitzMax Programming/Making a callback thread safe

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

Try this mate... (no promises)
Function Callback( threadIndex:Int ) "C" NoDebug
Global a:Int[ 2 ]
a[ threadindex ] = 3
EndFunction

IMHO thats about as safe as it gets ATM, if that still causes problems then you could try adding a critical section.

but if you're only going to be doing a bit of math in the callback I'd suggest writing it in C.