Replace RW lock with mutex, shared_mutex

Test: built, flashed, booted
      system/netd/tests/runtests.sh passes
Change-Id: I42b52d815b6ba0ba6f93dc27e83a900d2abec715
diff --git a/server/RouteController.cpp b/server/RouteController.cpp
index c78854d..ccec437 100644
--- a/server/RouteController.cpp
+++ b/server/RouteController.cpp
@@ -155,7 +155,7 @@
 }
 
 uint32_t RouteController::getIfIndex(const char* interface) {
-    android::RWLock::AutoRLock lock(sInterfaceToTableLock);
+    std::shared_lock<std::shared_mutex> lock(sInterfaceToTableLock);
 
     auto iter = sInterfaceToTable.find(interface);
     if (iter == sInterfaceToTable.end()) {
@@ -167,7 +167,7 @@
 }
 
 uint32_t RouteController::getRouteTableForInterface(const char* interface) {
-    android::RWLock::AutoRLock lock(sInterfaceToTableLock);
+    std::shared_lock<std::shared_mutex> lock(sInterfaceToTableLock);
     return getRouteTableForInterfaceLocked(interface);
 }
 
@@ -191,7 +191,7 @@
     addTableName(ROUTE_TABLE_LEGACY_NETWORK, ROUTE_TABLE_NAME_LEGACY_NETWORK, &contents);
     addTableName(ROUTE_TABLE_LEGACY_SYSTEM,  ROUTE_TABLE_NAME_LEGACY_SYSTEM,  &contents);
 
-    android::RWLock::AutoRLock lock(sInterfaceToTableLock);
+    std::shared_lock<std::shared_mutex> lock(sInterfaceToTableLock);
     for (const auto& entry : sInterfaceToTable) {
         addTableName(entry.second, entry.first, &contents);
     }
@@ -927,7 +927,7 @@
 
 // Returns 0 on success or negative errno on failure.
 WARN_UNUSED_RESULT int RouteController::flushRoutes(const char* interface) {
-    android::RWLock::AutoWLock lock(sInterfaceToTableLock);
+    std::lock_guard<std::shared_mutex> lock(sInterfaceToTableLock);
 
     uint32_t table = getRouteTableForInterfaceLocked(interface);
     if (table == RT_TABLE_UNSPEC) {
@@ -1089,9 +1089,9 @@
 }
 
 // Protects sInterfaceToTable.
-android::RWLock RouteController::sInterfaceToTableLock;
-
+std::shared_mutex RouteController::sInterfaceToTableLock;
 std::map<std::string, uint32_t> RouteController::sInterfaceToTable;
 
+
 }  // namespace net
 }  // namespace android