!1529 修改未加锁问题

Merge pull request !1529 from lihui/master
This commit is contained in:
openharmony_ci 2023-12-06 07:43:36 +00:00 committed by Gitee
commit c59aaf015a
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
4 changed files with 6 additions and 1 deletions

View File

@ -110,6 +110,7 @@ int WifiHotspotCallbackStub::RemoteOnHotspotStaLeave(uint32_t code, MessageParce
void WifiHotspotCallbackStub::RegisterCallBack(const sptr<IWifiHotspotCallback> &callBack)
{
std::unique_lock<std::mutex> lock(callBackEventMutex);
if (callBack == nullptr) {
WIFI_LOGD("RegisterCallBack:callBack is nullptr!");
return;

View File

@ -16,6 +16,7 @@
#ifndef OHOS_WIFI_HOTSPOT_CALLBACK_STUB_H
#define OHOS_WIFI_HOTSPOT_CALLBACK_STUB_H
#include <mutex>
#include "iremote_stub.h"
#include "i_wifi_hotspot_callback.h"
@ -43,7 +44,7 @@ private:
private:
sptr<IWifiHotspotCallback> userCallback_;
std::mutex callBackEventMutex;
bool mRemoteDied;
};
} // namespace Wifi

View File

@ -83,6 +83,7 @@ int WifiP2pCallbackStub::OnRemoteRequest(
void WifiP2pCallbackStub::RegisterCallBack(const sptr<IWifiP2pCallback> &userCallback)
{
std::unique_lock<std::mutex> lock(callBackEventMutex);
if (userCallback_ != nullptr) {
WIFI_LOGD("Callback has registered!");
return;

View File

@ -15,6 +15,7 @@
#ifndef OHOS_WIFI_P2P_CALLBACK_STUB_H
#define OHOS_WIFI_P2P_CALLBACK_STUB_H
#include <mutex>
#include <map>
#include "iremote_stub.h"
#include "i_wifi_p2p_callback.h"
@ -121,6 +122,7 @@ private:
HandleFuncMap handleFuncMap;
sptr<IWifiP2pCallback> userCallback_;
bool mRemoteDied;
std::mutex callBackEventMutex;
};
} // namespace Wifi
} // namespace OHOS