Skip to content
Snippets Groups Projects
Commit 022ced36 authored by Julian Oes's avatar Julian Oes
Browse files

shmem: don't do locking for now

The locking seems to be broken, therefore refrain from using it.
parent 070e71ed
No related branches found
No related tags found
No related merge requests found
......@@ -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)
......
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment