more messing with FetchNextBlocking
diff --git a/aos/linux_code/ipc_lib/queue.cc b/aos/linux_code/ipc_lib/queue.cc
index 8bcfa19..b19ef2c 100644
--- a/aos/linux_code/ipc_lib/queue.cc
+++ b/aos/linux_code/ipc_lib/queue.cc
@@ -427,7 +427,8 @@
const int unread_messages = messages_ - *index;
int current_messages = data_end_ - data_start_;
if (current_messages < 0) current_messages += data_length_ - 1;
- if (unread_messages > current_messages) { // If we're behind the available messages.
+ // If we're behind the available messages.
+ if (unread_messages > current_messages) {
// Catch index up to the last available message.
*index = messages_ - current_messages;
// And that's the one we're going to read.
@@ -435,8 +436,10 @@
} else {
// Just start reading at the first available message that we haven't yet
// read.
- my_start = (data_end_ - unread_messages) % data_length_;
- if (my_start < 0) my_start = data_start_ + unread_messages - 1;
+ my_start = data_end_ - unread_messages;
+ if (my_start < 0) {
+ my_start += data_length_;
+ }
}
if (options & kPeek) {
diff --git a/aos/linux_code/ipc_lib/shared_mem.c b/aos/linux_code/ipc_lib/shared_mem.c
index 850253d..9762663 100644
--- a/aos/linux_code/ipc_lib/shared_mem.c
+++ b/aos/linux_code/ipc_lib/shared_mem.c
@@ -36,6 +36,7 @@
struct aos_core *global_core = NULL;
+// TODO(brians): madvise(2) it to put this shm in core dumps.
int aos_core_create_shared_mem(enum aos_core_create to_create) {
static struct aos_core global_core_data;
global_core = &global_core_data;