Fix for Mantis #25041 . Correctly set CurrentThreadVar for those tthread.inc incarnations that don't use the default ThreadProc in classes.inc (this should be changed in the future though...). In addition to Unix systems as described by the bug report this also involved BeOS and Netware LibC.

+ added test


git-svn-id: http://svn.freepascal.org/svn/fpc/trunk@25511 3ad0048d-3df7-0310-abae-a5850022a9f2