Fix x86_64 compilation on Ubuntu 14.04
* Add necessary includes in bt_trace.h
* Add toolchain specific configs
* Add libc++ import for clang
* Add libc++abi include for clang
* Add ipc_handler_linux.cc in service/BUILD.gn
* Use shared_mutex when _LIBCPP_VERSION < 3500
* Updated the build instructions
Test: ninja -C out/Default
Change-Id: I362ebf33f62910be817339cc6bdc62830f57db30
diff --git a/README.md b/README.md
index fa247d0..3a62089 100644
--- a/README.md
+++ b/README.md
@@ -5,12 +5,13 @@
## Building and running on Linux
-Instructions for Ubuntu, tested on 15.10 with GCC 5.2.1.
+Instructions for Ubuntu, tested on 14.04 with Clang 3.5.0 and 16.10 with Clang
+ 3.8.0
### Install required libraries
```sh
-sudo apt-get install libevent-dev
+sudo apt-get install libevent-dev libc++-dev libc++abi-dev
```
### Install build tools
@@ -23,16 +24,19 @@
or download binary from https://github.com/ninja-build/ninja/releases
- - Install [gn](https://chromium.googlesource.com/chromium/src/tools/gn/) - meta-build system that generates NinjaBuild files.
+ - Install [gn](https://chromium.googlesource.com/chromium/src/tools/gn/) -
+ meta-build system that generates NinjaBuild files.
Get sha1 of current version from [here](
-https://chromium.googlesource.com/chromium/buildtools/+/master/linux64/gn.sha1) and then download corresponding executable:
+https://chromium.googlesource.com/chromium/buildtools/+/master/linux64/gn.sha1)
+ and then download corresponding executable:
```sh
wget -O gn http://storage.googleapis.com/chromium-gn/<gn.sha1>
```
-i.e. if sha1 is "3491f6687bd9f19946035700eb84ce3eed18c5fa" (value from 24 Feb 2016) do
+i.e. if sha1 is "3491f6687bd9f19946035700eb84ce3eed18c5fa" (value from 24 Feb
+ 2016) do
```sh
wget -O gn http://storage.googleapis.com/chromium-gn/3491f6687bd9f19946035700eb84ce3eed18c5fa
@@ -76,6 +80,20 @@
curl https://chromium.googlesource.com/chromium/src/base/+/master/third_party/valgrind/memcheck.h?format=TEXT | base64 -d > memcheck.h
```
+NOTE: If system/bt is checked out under AOSP, then create symbolic links instead
+of downloading sources
+
+```
+cd system/bt
+mkdir third_party
+cd third_party
+ln -s ../../../external/libchrome libchrome
+ln -s ../../../external/modp_b64 modp_b64
+ln -s ../../../external/tinyxml2 tinyxml2
+ln -s ../../../hardware/libhardware libhardware
+ln -s ../../../external/googletest googletest
+```
+
### Generate your build files
```sh
@@ -90,7 +108,9 @@
ninja -C out/Default all
```
-This will build all targets (the shared library, executables, tests, etc) and put them in out/Default. To build an individual target, replace "all" with the target of your choice, e.g. ```ninja -C out/Default net_test_osi```.
+This will build all targets (the shared library, executables, tests, etc) and
+ put them in out/Default. To build an individual target, replace "all" with the
+ target of your choice, e.g. ```ninja -C out/Default net_test_osi```.
### Run
@@ -98,3 +118,26 @@
cd ~/fluoride/bt/out/Default
LD_LIBRARY_PATH=./ ./bluetoothtbd -create-ipc-socket=fluoride
```
+
+### Eclipse IDE Support
+
+1. Follows the Chromium project
+ [Eclipse Setup Instructions](https://chromium.googlesource.com/chromium/src/+/master/docs/linux_eclipse_dev.md)
+ until "Optional: Building inside Eclipse" section (don't do that section, we
+ will set it up differently)
+
+2. Generate Eclipse settings:
+
+ ```sh
+ cd system/bt
+ gn gen --ide=eclipse out/Default
+ ```
+
+3. In Eclipse, do File->Import->C/C++->C/C++ Project Settings, choose the XML
+ location under system/bt/out/Default
+
+4. Right click on the project. Go to Preferences->C/C++ Build->Builder Settings.
+ Uncheck "Use default build command", but instead using "ninja -C out/Default"
+
+5. Goto Behaviour tab, change clean command to "-t clean"
+
diff --git a/build/config/BUILDCONFIG.gn b/build/config/BUILDCONFIG.gn
index fb71af5..148230b 100644
--- a/build/config/BUILDCONFIG.gn
+++ b/build/config/BUILDCONFIG.gn
@@ -15,12 +15,14 @@
#
set_default_toolchain("//build/toolchain/clang")
+toolchain_config="//build/toolchain/clang:clang_config"
set_defaults("executable") {
configs = [
"//build:linux",
"//build:gc",
"//build:default_include_dirs",
+ toolchain_config,
]
}
@@ -29,6 +31,7 @@
"//build:linux",
"//build:gc",
"//build:default_include_dirs",
+ toolchain_config,
]
}
@@ -37,6 +40,7 @@
"//build:linux",
"//build:gc",
"//build:default_include_dirs",
+ toolchain_config,
]
}
@@ -45,5 +49,6 @@
"//build:linux",
"//build:gc",
"//build:default_include_dirs",
+ toolchain_config,
]
}
diff --git a/build/toolchain/clang/BUILD.gn b/build/toolchain/clang/BUILD.gn
index 7035c38..aed5c05 100644
--- a/build/toolchain/clang/BUILD.gn
+++ b/build/toolchain/clang/BUILD.gn
@@ -16,6 +16,18 @@
clang = "clang"
clangxx = "clang++"
+config("clang_config") {
+ include_dirs = [
+ "/usr/include/libcxxabi",
+ ]
+ cflags_cc = [
+ "-stdlib=libc++",
+ ]
+ ldflags = [
+ "-stdlib=libc++",
+ ]
+}
+
toolchain("clang") {
tool("cc") {
depfile = "{{output}}.d"
diff --git a/include/bt_trace.h b/include/bt_trace.h
index d08403c..84a0a8a 100644
--- a/include/bt_trace.h
+++ b/include/bt_trace.h
@@ -18,6 +18,8 @@
#pragma once
+#include <stdint.h>
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/service/BUILD.gn b/service/BUILD.gn
index 19134c1..e156c72 100644
--- a/service/BUILD.gn
+++ b/service/BUILD.gn
@@ -38,6 +38,7 @@
"hal/fake_bluetooth_gatt_interface.cc",
"hal/fake_bluetooth_interface.cc",
"ipc/ipc_handler.cc",
+ "ipc/ipc_handler_linux.cc",
"ipc/ipc_manager.cc",
"ipc/linux_ipc_host.cc",
"logging_helpers.cc",
diff --git a/service/hal/bluetooth_gatt_interface.cc b/service/hal/bluetooth_gatt_interface.cc
index f7ddecb..be8c084 100644
--- a/service/hal/bluetooth_gatt_interface.cc
+++ b/service/hal/bluetooth_gatt_interface.cc
@@ -17,9 +17,7 @@
#include "service/hal/bluetooth_gatt_interface.h"
#include <mutex>
-#define _LIBCPP_BUILDING_SHARED_MUTEX
#include <shared_mutex>
-#undef _LIBCPP_BUILDING_SHARED_MUTEX
#include <base/logging.h>
#include <base/observer_list.h>
@@ -31,7 +29,11 @@
using std::unique_lock;
using std::shared_lock;
using std::mutex;
-using std::shared_timed_mutex;
+#if defined(OS_GENERIC) && defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 3500)
+using shared_mutex_impl = std::shared_mutex;
+#else
+using shared_mutex_impl = std::shared_timed_mutex;
+#endif
namespace bluetooth {
namespace hal {
@@ -45,7 +47,7 @@
// use unique_lock. If only accessing |g_interface| use shared lock.
//TODO(jpawlowski): this should be just shared_mutex, as we currently don't use
// timed methods. Change to shared_mutex when we upgrade to C++14
-shared_timed_mutex g_instance_lock;
+shared_mutex_impl g_instance_lock;
// Helper for obtaining the observer lists. This is forward declared here
// and defined below since it depends on BluetoothInterfaceImpl.
@@ -77,7 +79,7 @@
} while (0)
void RegisterClientCallback(int status, int client_if, bt_uuid_t* app_uuid) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - status: " << status << " client_if: " << client_if;
VERIFY_INTERFACE_OR_RETURN();
CHECK(app_uuid);
@@ -87,7 +89,7 @@
}
void RegisterScannerCallback(int status, int scanner_id, bt_uuid_t* app_uuid) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - status: " << status << " scanner_id: " << scanner_id;
VERIFY_INTERFACE_OR_RETURN();
CHECK(app_uuid);
@@ -97,7 +99,7 @@
}
void ScanResultCallback(bt_bdaddr_t* bda, int rssi, vector<uint8_t> adv_data) { // NOLINT(pass-by-value)
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
CHECK(bda);
@@ -108,7 +110,7 @@
}
void ConnectCallback(int conn_id, int status, int client_if, bt_bdaddr_t* bda) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
CHECK(bda);
@@ -123,7 +125,7 @@
void DisconnectCallback(int conn_id, int status, int client_if,
bt_bdaddr_t* bda) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
CHECK(bda);
@@ -136,7 +138,7 @@
}
void SearchCompleteCallback(int conn_id, int status) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
VLOG(2) << __func__ << " - conn_id: " << conn_id
@@ -146,7 +148,7 @@
}
void RegisterForNotificationCallback(int conn_id, int registered, int status, uint16_t handle) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
LOG(INFO) << __func__ << " - conn_id: " << conn_id
@@ -158,7 +160,7 @@
}
void NotifyCallback(int conn_id, btgatt_notify_params_t *p_data) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
VLOG(2) << __func__ << " - conn_id: " << conn_id
@@ -172,7 +174,7 @@
}
void WriteCharacteristicCallback(int conn_id, int status, uint16_t handle) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
VLOG(2) << __func__ << " - conn_id: " << conn_id
@@ -184,7 +186,7 @@
void WriteDescriptorCallback(int conn_id, int status,
uint16_t handle) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
VLOG(2) << __func__ << " - conn_id: " << conn_id
@@ -195,7 +197,7 @@
}
void MtuChangedCallback(int conn_id, int status, int mtu) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
VLOG(2) << __func__ << " - conn_id: " << conn_id
@@ -206,7 +208,7 @@
}
void GetGattDbCallback(int conn_id, btgatt_db_element_t *db, int size) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - conn_id: " << conn_id << " size: " << size;
VERIFY_INTERFACE_OR_RETURN();
@@ -215,7 +217,7 @@
}
void ServicesRemovedCallback(int conn_id, uint16_t start_handle, uint16_t end_handle) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - conn_id: " << conn_id
<< " start_handle: " << start_handle
<< " end_handle: " << end_handle;
@@ -226,7 +228,7 @@
}
void ServicesAddedCallback(int conn_id, btgatt_db_element_t *added, int added_count) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - conn_id: " << conn_id
<< " added_count: " << added_count;
VERIFY_INTERFACE_OR_RETURN();
@@ -236,7 +238,7 @@
}
void RegisterServerCallback(int status, int server_if, bt_uuid_t* app_uuid) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - status: " << status << " server_if: " << server_if;
VERIFY_INTERFACE_OR_RETURN();
CHECK(app_uuid);
@@ -247,7 +249,7 @@
void ConnectionCallback(int conn_id, int server_if, int connected,
bt_bdaddr_t* bda) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - conn_id: " << conn_id
<< " server_if: " << server_if << " connected: " << connected;
VERIFY_INTERFACE_OR_RETURN();
@@ -261,7 +263,7 @@
int status,
int server_if,
vector<btgatt_db_element_t> service) { // NOLINT(pass-by-value)
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - status: " << status << " server_if: " << server_if
<< " count: " << service.size();
VERIFY_INTERFACE_OR_RETURN();
@@ -272,7 +274,7 @@
}
void ServiceStoppedCallback(int status, int server_if, int srvc_handle) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - status: " << status << " server_if: " << server_if
<< " handle: " << srvc_handle;
VERIFY_INTERFACE_OR_RETURN();
@@ -282,7 +284,7 @@
}
void ServiceDeletedCallback(int status, int server_if, int srvc_handle) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - status: " << status << " server_if: " << server_if
<< " handle: " << srvc_handle;
VERIFY_INTERFACE_OR_RETURN();
@@ -293,7 +295,7 @@
void RequestReadCharacteristicCallback(int conn_id, int trans_id, bt_bdaddr_t* bda,
int attr_handle, int offset, bool is_long) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - conn_id: " << conn_id << " trans_id: " << trans_id
<< " attr_handle: " << attr_handle << " offset: " << offset
<< " is_long: " << is_long;
@@ -306,7 +308,7 @@
void RequestReadDescriptorCallback(int conn_id, int trans_id, bt_bdaddr_t* bda,
int attr_handle, int offset, bool is_long) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - conn_id: " << conn_id << " trans_id: " << trans_id
<< " attr_handle: " << attr_handle << " offset: " << offset
<< " is_long: " << is_long;
@@ -322,7 +324,7 @@
int attr_handle, int offset,
bool need_rsp, bool is_prep,
vector<uint8_t> value) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - conn_id: " << conn_id << " trans_id: " << trans_id
<< " attr_handle: " << attr_handle << " offset: " << offset
<< " length: " << value.size() << " need_rsp: " << need_rsp
@@ -340,7 +342,7 @@
int attr_handle, int offset,
bool need_rsp, bool is_prep,
vector<uint8_t> value) { // NOLINT(pass-by-value)
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - conn_id: " << conn_id << " trans_id: " << trans_id
<< " attr_handle: " << attr_handle << " offset: " << offset
<< " length: " << value.size() << " need_rsp: " << need_rsp
@@ -355,7 +357,7 @@
void RequestExecWriteCallback(int conn_id, int trans_id,
bt_bdaddr_t* bda, int exec_write) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - conn_id: " << conn_id << " trans_id: " << trans_id
<< " exec_write: " << exec_write;
VERIFY_INTERFACE_OR_RETURN();
@@ -366,7 +368,7 @@
}
void ResponseConfirmationCallback(int status, int handle) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - status: " << status << " handle: " << handle;
VERIFY_INTERFACE_OR_RETURN();
@@ -375,7 +377,7 @@
}
void IndicationSentCallback(int conn_id, int status) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - conn_id: " << conn_id << " status: " << status;
VERIFY_INTERFACE_OR_RETURN();
@@ -384,7 +386,7 @@
}
void MtuChangedCallback(int conn_id, int mtu) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VLOG(2) << __func__ << " - conn_id: " << conn_id << " mtu: " << mtu;
VERIFY_INTERFACE_OR_RETURN();
@@ -820,7 +822,7 @@
// static
bool BluetoothGattInterface::Initialize() {
- unique_lock<shared_timed_mutex> lock(g_instance_lock);
+ unique_lock<shared_mutex_impl> lock(g_instance_lock);
CHECK(!g_interface);
std::unique_ptr<BluetoothGattInterfaceImpl> impl(
@@ -837,7 +839,7 @@
// static
void BluetoothGattInterface::CleanUp() {
- unique_lock<shared_timed_mutex> lock(g_instance_lock);
+ unique_lock<shared_mutex_impl> lock(g_instance_lock);
CHECK(g_interface);
delete g_interface;
@@ -846,14 +848,14 @@
// static
bool BluetoothGattInterface::IsInitialized() {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
return g_interface != nullptr;
}
// static
BluetoothGattInterface* BluetoothGattInterface::Get() {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
CHECK(g_interface);
return g_interface;
}
@@ -861,7 +863,7 @@
// static
void BluetoothGattInterface::InitializeForTesting(
BluetoothGattInterface* test_instance) {
- unique_lock<shared_timed_mutex> lock(g_instance_lock);
+ unique_lock<shared_mutex_impl> lock(g_instance_lock);
CHECK(test_instance);
CHECK(!g_interface);
diff --git a/service/hal/bluetooth_interface.cc b/service/hal/bluetooth_interface.cc
index 88d29c7..fc751b5 100644
--- a/service/hal/bluetooth_interface.cc
+++ b/service/hal/bluetooth_interface.cc
@@ -17,9 +17,7 @@
#include "service/hal/bluetooth_interface.h"
#include <mutex>
-#define _LIBCPP_BUILDING_SHARED_MUTEX
#include <shared_mutex>
-#undef _LIBCPP_BUILDING_SHARED_MUTEX
#include <base/logging.h>
#include <base/observer_list.h>
@@ -32,7 +30,11 @@
using std::unique_lock;
using std::shared_lock;
using std::mutex;
-using std::shared_timed_mutex;
+#if defined(OS_GENERIC) && defined(_LIBCPP_VERSION) && (_LIBCPP_VERSION < 3500)
+using shared_mutex_impl = std::shared_mutex;
+#else
+using shared_mutex_impl = std::shared_timed_mutex;
+#endif
namespace bluetooth {
namespace hal {
@@ -46,7 +48,7 @@
// use unique_lock. If only accessing |g_interface| use shared lock.
//TODO(jpawlowski): this should be just shared_mutex, as we currently don't use
// timed methods. Change to shared_mutex when we upgrade to C++14
-shared_timed_mutex g_instance_lock;
+shared_mutex_impl g_instance_lock;
// Helper for obtaining the observer list. This is forward declared here and
// defined below since it depends on BluetoothInterfaceImpl.
@@ -64,7 +66,7 @@
} while (0)
void AdapterStateChangedCallback(bt_state_t state) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
VLOG(1) << "Adapter state changed: " << BtStateText(state);
FOR_EACH_BLUETOOTH_OBSERVER(AdapterStateChangedCallback(state));
@@ -73,7 +75,7 @@
void AdapterPropertiesCallback(bt_status_t status,
int num_properties,
bt_property_t* properties) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
VLOG(1) << "Adapter properties changed - status: " << BtStatusText(status)
<< ", num_properties: " << num_properties;
@@ -85,7 +87,7 @@
bt_bdaddr_t *remote_bd_addr,
int num_properties,
bt_property_t* properties) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
VLOG(1) << " Remote device properties changed - status: " << BtStatusText(status)
<< " - BD_ADDR: " << BtAddrString(remote_bd_addr)
@@ -96,7 +98,7 @@
}
void DiscoveryStateChangedCallback(bt_discovery_state_t state) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
VLOG(1) << "Discovery state changed - state: " << BtDiscoveryStateText(state);
FOR_EACH_BLUETOOTH_OBSERVER(DiscoveryStateChangedCallback(state));
@@ -104,7 +106,7 @@
void PinRequestCallback(bt_bdaddr_t *remote_bd_addr, bt_bdname_t *bd_name,
uint32_t cod, bool min_16_digit) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
VLOG(2) << __func__
<< " - remote_bd_addr: " << remote_bd_addr
@@ -116,7 +118,7 @@
void SSPRequestCallback(bt_bdaddr_t *remote_bd_addr,
bt_bdname_t *bd_name, uint32_t cod, bt_ssp_variant_t pairing_variant, uint32_t pass_key) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
VLOG(2) << __func__
<< " - remote_bd_addr: " << remote_bd_addr
@@ -131,7 +133,7 @@
bt_status_t status,
bt_bdaddr_t *remote_bd_addr,
bt_bond_state_t state) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
VLOG(2) << __func__
<< " - remote_bd_addr: " << BtAddrString(remote_bd_addr)
@@ -143,7 +145,7 @@
void AclStateChangedCallback(bt_status_t status,
bt_bdaddr_t *remote_bd_addr,
bt_acl_state_t state) {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
VERIFY_INTERFACE_OR_RETURN();
CHECK(remote_bd_addr);
VLOG(1) << "Remote device ACL state changed - status: "
@@ -232,12 +234,12 @@
// BluetoothInterface overrides.
void AddObserver(Observer* observer) override {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
observers_.AddObserver(observer);
}
void RemoveObserver(Observer* observer) override {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
observers_.RemoveObserver(observer);
}
@@ -381,7 +383,7 @@
// static
bool BluetoothInterface::Initialize() {
- unique_lock<shared_timed_mutex> lock(g_instance_lock);
+ unique_lock<shared_mutex_impl> lock(g_instance_lock);
CHECK(!g_bluetooth_interface);
std::unique_ptr<BluetoothInterfaceImpl> impl(new BluetoothInterfaceImpl());
@@ -397,7 +399,7 @@
// static
void BluetoothInterface::CleanUp() {
- unique_lock<shared_timed_mutex> lock(g_instance_lock);
+ unique_lock<shared_mutex_impl> lock(g_instance_lock);
CHECK(g_bluetooth_interface);
delete g_bluetooth_interface;
@@ -406,14 +408,14 @@
// static
bool BluetoothInterface::IsInitialized() {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
return g_bluetooth_interface != nullptr;
}
// static
BluetoothInterface* BluetoothInterface::Get() {
- shared_lock<shared_timed_mutex> lock(g_instance_lock);
+ shared_lock<shared_mutex_impl> lock(g_instance_lock);
CHECK(g_bluetooth_interface);
return g_bluetooth_interface;
}
@@ -421,7 +423,7 @@
// static
void BluetoothInterface::InitializeForTesting(
BluetoothInterface* test_instance) {
- unique_lock<shared_timed_mutex> lock(g_instance_lock);
+ unique_lock<shared_mutex_impl> lock(g_instance_lock);
CHECK(test_instance);
CHECK(!g_bluetooth_interface);