redo the aos_sync API and add PI support

Previously, it didn't have different types for mutexes vs futexes and
the one common type was poorly named. It's hard to split that change out
from adding PI support, so they're both together. Adding PI support is
important because we have many places (ie the logging queue) where high-priority
and low-priority code interact heavily.

This change adds some small parts of robustness support, but they all
result in CHECK/assert failures if triggered.

Change-Id: I841ccee52568c32d453ed14f930430debbd8d78e
diff --git a/aos/linux_code/ipc_lib/queue.cc b/aos/linux_code/ipc_lib/queue.cc
index e8e81dc..9219192 100644
--- a/aos/linux_code/ipc_lib/queue.cc
+++ b/aos/linux_code/ipc_lib/queue.cc
@@ -301,7 +301,8 @@
     printf("queue: %p->WriteMessage(%p, %x)\n", this, msg, options.printable());
   }
   {
-    MutexLocker locker(&data_lock_);
+    IPCMutexLocker locker(&data_lock_);
+    CHECK(!locker.owner_died());
     bool writable_waited = false;
 
     int new_end;
@@ -327,7 +328,7 @@
         if (kWriteDebug) {
           printf("queue: going to wait for writable_ of %p\n", this);
         }
-        writable_.Wait();
+        CHECK(!writable_.Wait());
         writable_waited = true;
       }
     }
@@ -384,7 +385,7 @@
       }
       readable_waiting_ = true;
       // Wait for a message to become readable.
-      readable_.Wait();
+      CHECK(!readable_.Wait());
       if (kReadDebug) {
         printf("queue: done waiting for readable_ of %p\n", this);
       }
@@ -415,7 +416,8 @@
   }
   void *msg = NULL;
 
-  MutexLocker locker(&data_lock_);
+  IPCMutexLocker locker(&data_lock_);
+  CHECK(!locker.owner_died());
 
   if (!ReadCommonStart(options, nullptr)) {
     if (kReadDebug) {
@@ -477,7 +479,8 @@
   }
   void *msg = NULL;
 
-  MutexLocker locker(&data_lock_);
+  IPCMutexLocker locker(&data_lock_);
+  CHECK(!locker.owner_died());
 
   if (!ReadCommonStart(options, index)) {
     if (kReadDebug) {