Threads and windows (both MS windows and openwindow actuall)

Just starting out? Need help? Post your questions and find answers here.
jesperbrannmark
Enthusiast
Enthusiast
Posts: 536
Joined: Mon Feb 16, 2009 10:42 am
Location: sweden
Contact:

Threads and windows (both MS windows and openwindow actuall)

Post 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
jesperbrannmark
Enthusiast
Enthusiast
Posts: 536
Joined: Mon Feb 16, 2009 10:42 am
Location: sweden
Contact:

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

Post by jesperbrannmark »

Actually the delay doenst prevent the crash, it just makes me able to do more windows...es..
jesperbrannmark
Enthusiast
Enthusiast
Posts: 536
Joined: Mon Feb 16, 2009 10:42 am
Location: sweden
Contact:

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

Post 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...
Fred
Administrator
Administrator
Posts: 18162
Joined: Fri May 17, 2002 4:39 pm
Location: France
Contact:

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

Post by Fred »

The gui has to be running on the main thread on OS X.
Post Reply