We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
Passing thread-IDs via global variables is nothing ugly unless these are "constant".In your case, since threads are created on start-up the thread-id won't change later on.Regarding your problem, the simplest thing is to activate the interrupt from within the foreground thread.So it is sure the global thread-id is valid.