wip: rebasing @tknopp's threading branch

@StefanKarpinski It is used in `threading.cpp` for obtaining the types of the arguments for a thread. I put a declaration into `julia_internal.h`and removed the `static` here to make the function global available.