RIOT-OS/RIOT — pull request #758 by Kijewski (2014-02-21 16:38:39+00:00)
Title: Fix `pthread_self()` confusion

Thos fixes #755.

The pthread ID cannot be reused as soon as the thread ends, because
another thread need to join it first. `pthread_self()` uses the native
(i.e. RIOT's) thread ID to distinguish itself. A native thread ID can be
reused as soon as the thread ends, since the core knows no join
operation.

In order to not confuse itself with an earlier zombie thread (i.e a dead
non-detached thread, that was not joined, yet), we need to invalidate
the associated native thread ID.

This approach is sane since a dead thread won't call `pthread_self()`
anymore.