fixup "libc: don't take alien thread for main pthread"

/plain/krishna/src/genode/genode.git/libports/src/lib/pthread/thread.cc:463:48: required from here
/plain/krishna/src/genode/genode.git/base/include/util/misc_math.h:20:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
fixup "run: limit created threads in test"
linux: halt thread in lock after join notification

Using the generic sleep_forever() induced the use of an Ipc_server
object, which uses the thread-local server socket. This socket may have
been closed by another thread in the meantime due to destruction of the
actual thread object. That leads to an Ipc_error exception, which is not
caught by the halted thread, and, therefore, to program termination.

@nfeske this is just a fix for the current bug in test-thread, but I
vote for implementation of sleep_forever() via a lock on stack at least
on linux. What do you think? Are there corner cases I do not see?