I have a method that can be called from a thread or not (I didn’t program this part). Is there a simple way to determine if the method is being called from the main thread or from within a thread? I have to do this because if I’m in the main thread I display a message, but if I’m within a thread I just want to log the error.
Short of rewriting a lot of code to handle this I’m wondering if there’s a less intrusive way of checking for this.
App.CurrentThread will be nil if on the main thread.
if App.CurrentThread = nil then
// Thread safe error handling
Ug. I hate it when I knew the answer and forgot that I knew it. Thanks.
Similarly, I hate when @Bob Keeney knows the answer and I forgot that Bob knew it. (This applies to most things.)
I know Kem was itching to reply with a regex solution because he has not spoken Klingon in 24 hrs.
I’ll bet there’s a RegEx for that!
I’m good at other things too, you know, like… like… other things!
If there is a RegEx solution for it, Kem is the guy who can write it.