From 7bb70313da63e601c8622687839ea4d3a9f22998 Mon Sep 17 00:00:00 2001 From: Mark Charlebois Date: Mon, 8 Jun 2015 21:36:01 -0700 Subject: [PATCH] POSIX: use px4_getpid() The posix build only has one process so calling getpid() will not provide the expected result. Signed-off-by: Mark Charlebois --- .../posix/px4_layer/px4_posix_tasks.cpp | 15 +++++++++ src/platforms/px4_posix.h | 5 --- .../qurt/px4_layer/px4_qurt_tasks.cpp | 33 +++++++++++-------- 3 files changed, 34 insertions(+), 19 deletions(-) diff --git a/src/platforms/posix/px4_layer/px4_posix_tasks.cpp b/src/platforms/posix/px4_layer/px4_posix_tasks.cpp index c539fa7266..eb442e708b 100644 --- a/src/platforms/posix/px4_layer/px4_posix_tasks.cpp +++ b/src/platforms/posix/px4_layer/px4_posix_tasks.cpp @@ -273,6 +273,21 @@ void px4_show_tasks() } __BEGIN_DECLS + +int px4_getpid() +{ + pthread_t pid = pthread_self(); + + // Get pthread ID from the opaque ID + for (int i=0; i