Create threadsafe executable

Mac OSX specific forum
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Create threadsafe executable

Post by J. Baker »

Has anyone else created a threadsafe executable in Mac OS X? My program keeps crashing after doing its task but this works fine on XP. Just trying to verify so I can track down what's causing this crash.
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
User avatar
J. Baker
Addict
Addict
Posts: 2181
Joined: Sun Apr 27, 2003 8:12 am
Location: USA
Contact:

Re: Create threadsafe executable

Post by J. Baker »

I swear, I can spend weeks on something but until I ask, I will not figure it out. But I found the issue. I have a MessageRequester() in my thread that pops up when complete. While this works on XP, is this not proper?
www.posemotion.com

PureBasic Tools for OS X: PureMonitor, plist Tool, Data Maker & App Chef


Even the vine knows it surroundings but the man with eyes does not.
User avatar
tarmsaft
User
User
Posts: 37
Joined: Sat Jun 30, 2007 12:03 pm
Location: San Francisco

Re: Create threadsafe executable

Post by tarmsaft »

I run threads in some applications. I have more or less the same problem. Random crashes. Perhaps the mutex system in PB is not properly adapted for the mac? (wild speculation).
But since it is not possible to debug threads on the mac version I have given up trying to get my code stable.
MacBook Pro (model 7,1) - 2.4GHz Intel Core 2 Duo 4GB - OS X 10.7 Lion.
PB 4.60 RC1
jesperbrannmark
Enthusiast
Enthusiast
Posts: 536
Joined: Mon Feb 16, 2009 10:42 am
Location: sweden
Contact:

Re: Create threadsafe executable

Post by jesperbrannmark »

Hi. My program worked fine as well in Windows.
When moving to Mac OS it was a different story.
I got the suggestion here in the forum to try not threadsafe and... it was so much faster and stable.
The messagerequester is sometimes not modular (it doesnt freeze events), especially when you have a callback of some sort.
I suspect the messagerequester might need to be in the main thread as well (since its a window, or sort of)

Some notes I found out on the way that might help you:
* You can get a different behavour on a "compile&run" than a "create executable" - so always remember to try that one.
* When I do coding "badboy" style (write some junk code that doesnt feel 100%) it usually works in Windows - but thats not the case with Mac. You need to be sensitive to how you work.
* Seperate windows is not handled by seperate threads - the MAIN thread does the window handeling.
* A messagerequester is not always modular!!!!! Remember that!! I use a "global modular.b=0" and before a messagerequester i set modular.b=1 which just skips my windowhandling procedure - otherwise it can crash big time.
* Webgadgets doesnt print, doesnt support some elements, are slow and send events like crazy.
* And as I found out a week ago; you can do a lot of tricks with Applescript (like webpages, burning CD's, webcam stuff etc)
Post Reply