All the rest of my code is event driven ;) I see people here post all the time how they want to send and receive things from sockets in the same line of code execution and I always groan too. I have no trouble using the events async and a state machine affair for managing complex protocols and the like.
This particular problem is biting me in 2 places. During my app.open event when I have to load a large database of data and give a little feedback as to the progress, and when people do a manual saving or exporting of this database. In the case of the open event there aren’t any events that can be expected and nothing else is happening in the app yet and so doing it all inline in the main thread doesn’t feel like a problem to me, and it hasn’t been for the last 10 versions of Xojo or so ;) In the second case of a human selecting to export the database I have to stop all other code execution and events anyway as the database has to have all it’s caches and datas written to disk, it can’t be accepting new data in the middle of the save or very strange things will happen. So there I WANT it to be blocking and inline and all in one process.
Whenever I move to the next dataset to read I update the status label display that says what it’s loading or saving, and once a second or so I update the progress bar.
This is really not an example of something that needs to be threaded or isn’t event driven. To thread the first one would not be that difficult as there isn’t anything else happening yet that could bump into it. I would just have to change all the accessors of the windows so that they simply set local variables in the window I could update from in a timer in the window. The second example I want everything else to stop while I’m working on the database so I would have to block the main thread from any events coming in on any sockets or other things. I’m sure that could be done.
In both those cases I don’t feel like I should have to do that though. I’m working around what is pretty obviously a bug. I do not believe that apple means for 64 bit apps to be unable to force a window refresh when the developer wants to do so do they? When they do it perfectly in 32 bit apps? So it’s either a bug in Xojo’s libraries or in Apple’s and if I send a day or two moving these things to threads and re-testing to make sure I’m not going to get a socket event while the database is saving it feels like a waste of time.
I should be able to force a window update when I want to shouldn’t I? This is different I think from the other changes that affect when drawing happens in OSX now. I see those strange black windows and such in the 32 bit version of the app too. But in the 32 bit version I can still call to refresh or updateNow and make the window draw itself. Under a 64 bit compile that call does nothing. It’s a 64 bit compile bug, either xojo’s or apples.