Allow runOnLoop from foreign thread and built in context checking