Page 1 of 1

Threads and windows (both MS windows and openwindow actuall)

Posted: Thu Feb 10, 2011 2:31 pm
by jesperbrannmark
I have a lot of issues with windows that run their own threads.

Code: Select all

Procedure open(x)
  OpenWindow(x,100,100,500,500,"WINDOW "+Str(x))
  Repeat
    Until WaitWindowEvent()=#PB_Event_CloseWindow
  EndProcedure
  For a=1 To 10
    CreateThread(@open(),a)
    Delay(500) ;Remove this=crash.
  Next
  Repeat
    Delay(100)
    ForEver
I know this isnt the most pretty example of threading... But say I want 10 windows with their unique windowID running on a seperate thread.

In Windows = works
In MacOS = IMA, why? I depend on windowses running their own thread. I have really no alternative.... Any suggestions? Is this a bug?

Jesper

Re: Threads and windows (both MS windows and openwindow actu

Posted: Thu Feb 10, 2011 2:32 pm
by jesperbrannmark
Actually the delay doenst prevent the crash, it just makes me able to do more windows...es..

Re: Threads and windows (both MS windows and openwindow actu

Posted: Thu Feb 10, 2011 2:38 pm
by jesperbrannmark
I forgot to do threadsafe compiling on that example... But the problem still presists. I don't have any command over the windows...es...

Re: Threads and windows (both MS windows and openwindow actu

Posted: Fri Apr 13, 2012 1:10 pm
by Fred
The gui has to be running on the main thread on OS X.