scheduler: Work around GCC2 limitations in function inlining

GCC2 won't inline a function if it is used before its definition.
scheduler: Improve thread creation performance