diff options
| author | Frédéric Desbiens <[email protected]> | 2026-10-02 10:42:44 -0400 |
|---|---|---|
| committer | GitHub <[email protected]> | 2026-10-02 10:42:44 -0400 |
| commit | 93387b0a60382a29579bbad5045c68328e3751df (patch) | |
| tree | 42be790d602cb76f55090e5a7c418df7ea2b3428 /utility/rtos_compatibility_layers/posix/px_pth_self.c | |
| parent | 44d7c95c582d415c4ad84527180b29c93c3bf664 (diff) | |
| parent | 28281cd5647d4671236ca08d19bd18ed15b2265a (diff) | |
Merge pull request #783 from eclipse-threadx/devv6.5.2.202603_rel
Merged changes ahead of the v6.5.2.202603 release
Diffstat (limited to 'utility/rtos_compatibility_layers/posix/px_pth_self.c')
| -rw-r--r-- | utility/rtos_compatibility_layers/posix/px_pth_self.c | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/utility/rtos_compatibility_layers/posix/px_pth_self.c b/utility/rtos_compatibility_layers/posix/px_pth_self.c index fd876459..2272fa31 100644 --- a/utility/rtos_compatibility_layers/posix/px_pth_self.c +++ b/utility/rtos_compatibility_layers/posix/px_pth_self.c @@ -74,12 +74,21 @@ pthread_t thread_ID; thread_ID = posix_thread2tid(thread_ptr); - /* Determine if this thread is actually the signal thread helper. */ - if (((POSIX_TCB *) thread_ptr) -> signals.signal_handler) + /* Only a pthread has the signal fields read below: they belong to the + POSIX_TCB that surrounds the thread, and reading them through anything + else runs off the end of a plain TX_THREAD. A zero ID means the caller + is not a pthread, either because it is a ThreadX thread created directly + or because there is no current thread at all, so leave it alone. */ + if (thread_ID != (pthread_t) 0) { - /* Yes, override the thread_ID with the non-signal thread ID. */ - thread_ID = (pthread_t) ((POSIX_TCB *) thread_ptr) -> signals.base_thread_ptr; + /* Determine if this thread is actually the signal thread helper. */ + if (((POSIX_TCB *) thread_ptr) -> signals.signal_handler) + { + + /* Yes, override the thread_ID with the non-signal thread ID. */ + thread_ID = (pthread_t) ((POSIX_TCB *) thread_ptr) -> signals.base_thread_ptr; + } } |
