Fix dangerous casts of int variables to pointers in thread join function
calls. On LP64 systems, int and pointers are different sizes, so
writes can corrupt memory.
Since we're now including jemalloc_internal.h, all the required headers
are already pulled. This will avoid having to fiddle with headers that can
or can't be used with MSVC. Also, now that we use malloc_printf, we can use
util.h's definition of assert instead of assert.h's.