Page 1 of 1

Create threadsafe executable

Posted: Thu May 12, 2011 6:52 pm
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.

Re: Create threadsafe executable

Posted: Thu May 12, 2011 7:28 pm
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?

Re: Create threadsafe executable

Posted: Fri May 13, 2011 4:49 am
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.

Re: Create threadsafe executable

Posted: Fri May 13, 2011 8:04 am
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)