From 022ced3648fe94baf9fb54d189714f6ed141749b Mon Sep 17 00:00:00 2001 From: Julian Oes Date: Wed, 9 Mar 2016 11:07:34 -0800 Subject: [PATCH] shmem: don't do locking for now The locking seems to be broken, therefore refrain from using it. --- src/platforms/posix/px4_layer/shmem_posix.c | 15 ++++++++++++--- src/platforms/qurt/px4_layer/shmem_qurt.c | 7 +++++++ 2 files changed, 19 insertions(+), 3 deletions(-) diff --git a/src/platforms/posix/px4_layer/shmem_posix.c b/src/platforms/posix/px4_layer/shmem_posix.c index 67a5a1c652..d6c595ee89 100644 --- a/src/platforms/posix/px4_layer/shmem_posix.c +++ b/src/platforms/posix/px4_layer/shmem_posix.c @@ -102,9 +102,12 @@ static void *map_memory(off_t target) int get_shmem_lock(const char *caller_file_name, int caller_line_number) { + // TODO FIXME: just say this went through + return 0; + int i = 0; - /*ioctl calls cmpxchg*/ + /* TODO: make this comment so somebody can understand it: ioctl calls cmpxchg */ while (ioctl(mem_fd, LOCK_MEM) != 0) { usleep(10000); //sleep for 10 msec @@ -117,13 +120,19 @@ int get_shmem_lock(const char *caller_file_name, int caller_line_number) } } - PX4_INFO("got a lock!"); return 0; //got the lock } void release_shmem_lock(void) { - ioctl(mem_fd, UNLOCK_MEM); + // TODO FIXME: just say this went through + return; + + int ret = ioctl(mem_fd, UNLOCK_MEM); + + if (ret != 0) { + PX4_INFO("unlock failed, ret: %d, errno %d", ret, errno); + } } void init_shared_memory(void) diff --git a/src/platforms/qurt/px4_layer/shmem_qurt.c b/src/platforms/qurt/px4_layer/shmem_qurt.c index 3f00a7daa1..5e7727b12b 100644 --- a/src/platforms/qurt/px4_layer/shmem_qurt.c +++ b/src/platforms/qurt/px4_layer/shmem_qurt.c @@ -76,6 +76,9 @@ static void *map_memory(off_t target) int get_shmem_lock(const char *caller_file_name, int caller_line_number) { + // TODO: don't do this for now + return 0; + unsigned char *lock = (unsigned char *)(MAP_ADDRESS + LOCK_OFFSET); unsigned int i = 0; @@ -101,6 +104,10 @@ int get_shmem_lock(const char *caller_file_name, int caller_line_number) void release_shmem_lock(void) { + // TODO: don't do this either + PX4_INFO("unlocking"); + return; + unsigned char *lock = (unsigned char *)(MAP_ADDRESS + LOCK_OFFSET); *lock = 1;