Don't attempt locking when scheduler isn't active.
Threading functions in module api now implemented.