The reason for this is that ImageOutput(#Image3) returns 0.
It works without any problems when I disable 'create threadsave executable'.
So at the moment it's not possible for me to use 2D drawings to an image inside a thread.
Code: Select all
#WindowMain = 1
#Image3 = 3
#ImageGadget = 22
Global gBY_Exit.b
;Global gMX_Image3.l
Procedure MainThread( wert )
;LockMutex( gMX_Image3 )
Debug "2. ImageOutput: " + Str( ImageOutput( #Image3 ) )
;UnlockMutex( gMX_Image3 )
Repeat
Delay(10)
ForEver
EndProcedure
If OpenWindow( #WindowMain, 100, 100, 500, 400, "Test", #PB_Window_SizeGadget | #PB_Window_SystemMenu )
CreateImage( #Image3, 200, 200 )
;gMX_Image3 = CreateMutex()
If CreateGadgetList( WindowID( #WindowMain ) )
ImageGadget( #ImageGadget, 20, 20, 200, 200, ImageID( #Image3 ) )
;LockMutex( gMX_Image3 )
Debug "1. ImageOutput: " + Str( ImageOutput( #Image3 ) )
;UnlockMutex( gMX_Image3 )
CreateThread( @MainThread(), 0 )
Repeat
Select WaitWindowEvent()
Case #PB_Event_CloseWindow : gBY_Exit = #True
EndSelect
Until gBY_Exit
EndIf
EndIf


