I'm still in the process of figuring how that would work. But mostly it would look something like annotation
@threading("BACKGROUND_WORK_QUEUE_A")
func someWork(data) {}
and you wouldn't be able to directly call someWork() from requestHandler() directly, but calling someSubWork() from someWork() would be fine.
The idea is that i've observed that my code could often be split into parts running in their own threads, and the complex thread splitting code would be at the junction.
Adding annotation like that would help me make sure that a function designed to run inside some part wouldn't accidentaly be called directly from another part.
@threading("BACKGROUND_WORK_QUEUE_A") func someSubWork(data) {}
@threading("MAIN_QUEUE") func requestHandler() {}
and you wouldn't be able to directly call someWork() from requestHandler() directly, but calling someSubWork() from someWork() would be fine.
The idea is that i've observed that my code could often be split into parts running in their own threads, and the complex thread splitting code would be at the junction.
Adding annotation like that would help me make sure that a function designed to run inside some part wouldn't accidentaly be called directly from another part.