[riot-commits] [RIOT-OS/RIOT] ca4337: Fix `pthread_self()` confusion

Christian Mehlis mehlis at inf.fu-berlin.de
Sat Feb 22 18:30:15 CET 2014


  Branch: refs/heads/master
  Home:   https://github.com/RIOT-OS/RIOT
  Commit: ca4337ab4ddca11ad7f34232651cb2d7d0a612c9
      https://github.com/RIOT-OS/RIOT/commit/ca4337ab4ddca11ad7f34232651cb2d7d0a612c9
  Author: René Kijewski <rene.kijewski at fu-berlin.de>
  Date:   2014-02-21 (Fri, 21 Feb 2014)

  Changed paths:
    M sys/posix/pthread/pthread.c

  Log Message:
  -----------
  Fix `pthread_self()` confusion

This fixes #755.

The pthread ID cannot be reused as soon as the thread ends, because
another thread needs 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.


  Commit: 2de9619f2179baacc8c6c2655f061d9e9a9a3780
      https://github.com/RIOT-OS/RIOT/commit/2de9619f2179baacc8c6c2655f061d9e9a9a3780
  Author: Christian Mehlis <mehlis at inf.fu-berlin.de>
  Date:   2014-02-22 (Sat, 22 Feb 2014)

  Changed paths:
    M sys/posix/pthread/pthread.c

  Log Message:
  -----------
  Merge pull request #758 from Kijewski/issue-755

Fix `pthread_self()` confusion


Compare: https://github.com/RIOT-OS/RIOT/compare/668c29ca5208...2de9619f2179


More information about the commits mailing list