I have a weird problem here. I have been a decade using the same code on RB but after upgrading to Xojo that code no longer works on Windows. I got no error and no exceptions are thrown, simply the code doesn’t run.
The code is this:
myThread = new my_Thread( parameters here )
If myThread <> nil then myThread.Run()
myThread.Run() never run, I get no nil exception nor no other exception, the object is created but the command myThread.Run() does nothing.
This problem happens on Windows only. It worked fine in RB.
On Mac OS it just works as usual.
Any clue? The code above is inside a method of a SSLSocket object.
myThread is created in the SSLSocket object, not in that specific method…
I have tried this:
Select case myThread.state
case thread.Running
Log_Connection( " ~ Thread State = Running" + EndOfLine, Num )
case thread.Waiting
Log_Connection( " ~ Thread State = Waiting" + EndOfLine, Num )
case thread.Sleeping
Log_Connection( " ~ Thread State = Sleeping" + EndOfLine, Num )
case thread.Suspended
Log_Connection( " ~ Thread State = Suspended" + EndOfLine, Num )
case thread.NotRunning
Log_Connection( " ~ Thread State = Not Running" + EndOfLine, Num )
end Select
SendMessage.Run()
Select case myThread.state
case thread.Running
Log_Connection( " ~ Thread State = Running" + EndOfLine, Num )
case thread.Waiting
Log_Connection( " ~ Thread State = Waiting" + EndOfLine, Num )
case thread.Sleeping
Log_Connection( " ~ Thread State = Sleeping" + EndOfLine, Num )
case thread.Suspended
Log_Connection( " ~ Thread State = Suspended" + EndOfLine, Num )
case thread.NotRunning
Log_Connection( " ~ Thread State = Not Running" + EndOfLine, Num )
end Select
On Mac OS I get:
~ Thread State = Not Running
~ Thread State = Running
On Windows I get:
~ Thread State = Not Running
~ Thread State = Not Running
I know this may be an obvious question… but just to make sure, is there a do/loop in the thread that keeps it alive until it gets done processing? If not, the thread may be running once and closing prematurely… causing it to return as not running on the validation (as it already finished). I’ve never had any issues with threads running properly on Windows…
Actually the code has been working fine for about 10 years on both Mac and Windows. Now it works only on the Mac.
It is a Windows-only failure on Xojo. No Problem with last RealBasic version (previous to first Xojo version).
I have been checking all possible exceptions, nil values…etc… nothing. No error is thrown, the thread simply doesn’t start.
Alright, I apologize for suggesting the obvious… just running through the bases here. The only time this has ever happened to me on Windows (a thread spontaneously closing or failing to run) is when something in the thread itself caused an error, and closed the thread. If I remember right, I didn’t get a notification in the IDE when debugging of the issue. I’ll sift through some old source and see if I can find what caused it and let you know.
The sample project is to be built on a Mac and ran on MS Windows. I can compile it here without problems. This problem has forced me to go back to RealBasic, actually the Xojo failure is so BIG I have lost confidence, I have 9 more projects using threads on Windows. I haven’t released anything with Xojo so far. I don’t understand how changing/enhancing an ID can break threads on Windows :-/
Originally I released the defective application to my customer base, I got several hundreds of reports so it is not just me but all my MS Windows clients. I had to downgrade to Realbasic, build again and I saved the situation. No problem here.
So far, for me, Xojo is just for “playing”. After 4 months I am still waiting for a fix … what else can I do? Use RealBasic forever?
Christian, Run doesn’t work on that very specific situation, a Mac Xojo build for MS Windows. I am not superficial, there are lots of testing here, I never post something if I am not 100% sure there is a problem. Windows problems are probably getting less attention, they are low priority, Web edition is a black hole that is concentrating all resources, my problem is weird, nobody cares, it only affects me. Each time I post a reminder I get responses like yours. I don’t see any effort in fixing that. My only chances here are making some noise from time to time… :-/
If it’s a problem of cross compiling, well does it really go away when compiling on Windows?
That may point to problems in cross compiling. e.g. with my plugins we had such problems when Mac and Win plugin didn’t have same size of data structures. The compiler would pick size from Mac, built that in windows app and that app would crash.