mirror of
https://github.com/RetroShare/RetroShare.git
synced 2024-12-26 16:09:35 -05:00
Changed in Libresapi: Locking mutex using macro instead of RsStackMutex object creation
This commit is contained in:
parent
74a56f646d
commit
6a61e0a781
@ -200,13 +200,13 @@ ChatHandler::~ChatHandler()
|
||||
|
||||
void ChatHandler::notifyChatMessage(const ChatMessage &msg)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
mRawMsgs.push_back(msg);
|
||||
}
|
||||
|
||||
void ChatHandler::notifyChatCleared(const ChatId &chat_id)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
//Remove processed messages
|
||||
std::list<Msg>& msgs = mMsgs[chat_id];
|
||||
msgs.clear();
|
||||
@ -225,14 +225,14 @@ void ChatHandler::notifyChatCleared(const ChatId &chat_id)
|
||||
|
||||
void ChatHandler::notifyChatStatus(const ChatId &chat_id, const std::string &status)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
locked_storeTypingInfo(chat_id, status);
|
||||
}
|
||||
|
||||
void ChatHandler::notifyChatLobbyEvent(uint64_t lobby_id, uint32_t event_type,
|
||||
const RsGxsId &nickname, const std::string& any_string)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
if(event_type == RS_CHAT_LOBBY_EVENT_PEER_STATUS)
|
||||
{
|
||||
locked_storeTypingInfo(ChatId(lobby_id), any_string, nickname);
|
||||
@ -243,14 +243,14 @@ void ChatHandler::notifyListChange(int list, int /*type*/)
|
||||
{
|
||||
if(list == NOTIFY_LIST_CHAT_LOBBY_INVITATION)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
mStateTokenServer->replaceToken(mInvitationsStateToken);
|
||||
}
|
||||
}
|
||||
|
||||
void ChatHandler::tick()
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
|
||||
// first fetch lobbies
|
||||
std::vector<Lobby> lobbies;
|
||||
@ -868,7 +868,7 @@ void ChatHandler::locked_storeTypingInfo(const ChatId &chat_id, std::string stat
|
||||
|
||||
void ChatHandler::handleWildcard(Request &/*req*/, Response &resp)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
resp.mDataStream.getStreamToMember();
|
||||
for(std::map<ChatId, std::list<Msg> >::iterator mit = mMsgs.begin(); mit != mMsgs.end(); ++mit)
|
||||
{
|
||||
@ -882,7 +882,7 @@ void ChatHandler::handleLobbies(Request &/*req*/, Response &resp)
|
||||
tick();
|
||||
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
resp.mDataStream.getStreamToMember();
|
||||
for(std::vector<Lobby>::iterator vit = mLobbies.begin(); vit != mLobbies.end(); ++vit)
|
||||
{
|
||||
@ -1021,7 +1021,7 @@ void ChatHandler::handleAnswerToInvitation(Request& req, Response& resp)
|
||||
|
||||
ResponseTask* ChatHandler::handleLobbyParticipants(Request &req, Response &resp)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
|
||||
ChatId id(req.mPath.top());
|
||||
if(!id.isLobbyId())
|
||||
@ -1122,7 +1122,7 @@ void ChatHandler::handleMessages(Request &req, Response &resp)
|
||||
tick();
|
||||
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
ChatId id(req.mPath.top());
|
||||
|
||||
// make response a list
|
||||
@ -1204,7 +1204,7 @@ void ChatHandler::handleMarkMessageAsRead(Request &req, Response &resp)
|
||||
|
||||
void ChatHandler::handleMarkChatAsRead(Request &req, Response &resp)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
ChatId id(req.mPath.top());
|
||||
|
||||
if(id.isNotSet())
|
||||
@ -1235,7 +1235,7 @@ void ChatHandler::handleMarkChatAsRead(Request &req, Response &resp)
|
||||
|
||||
void ChatHandler::handleInfo(Request &req, Response &resp)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
ChatId id(req.mPath.top());
|
||||
if(id.isNotSet())
|
||||
{
|
||||
@ -1319,7 +1319,7 @@ protected:
|
||||
|
||||
ResponseTask* ChatHandler::handleReceiveStatus(Request &req, Response &resp)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
ChatId id(req.mPath.top());
|
||||
if(id.isNotSet())
|
||||
{
|
||||
@ -1354,7 +1354,7 @@ void ChatHandler::handleSendStatus(Request &req, Response &resp)
|
||||
|
||||
void ChatHandler::handleUnreadMsgs(Request &/*req*/, Response &resp)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); /********** LOCKED **********/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
|
||||
resp.mDataStream.getStreamToMember();
|
||||
for( std::map<ChatId, std::list<Msg> >::const_iterator mit = mMsgs.begin();
|
||||
|
@ -31,7 +31,7 @@ FileSearchHandler::~FileSearchHandler()
|
||||
|
||||
void FileSearchHandler::notifyTurtleSearchResult(uint32_t search_id, const std::list<TurtleFileInfo>& files)
|
||||
{
|
||||
RsStackMutex stackMtx(mMtx); // ********** STACK LOCKED MTX **********
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
std::map<uint32_t, Search>::iterator mit = mSearches.find(search_id);
|
||||
if(mit == mSearches.end())
|
||||
return;
|
||||
@ -85,7 +85,7 @@ void FileSearchHandler::handleWildcard(Request &req, Response &resp)
|
||||
}
|
||||
|
||||
{
|
||||
RsStackMutex stackMtx(mMtx); // ********** STACK LOCKED MTX **********
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
std::map<uint32_t, Search>::iterator mit = mSearches.find(id);
|
||||
if(mit == mSearches.end())
|
||||
{
|
||||
@ -115,7 +115,7 @@ void FileSearchHandler::handleWildcard(Request &req, Response &resp)
|
||||
else
|
||||
{
|
||||
// list searches
|
||||
RsStackMutex stackMtx(mMtx); // ********** STACK LOCKED MTX **********
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
resp.mDataStream.getStreamToMember();
|
||||
for(std::map<uint32_t, Search>::iterator mit = mSearches.begin(); mit != mSearches.end(); ++mit)
|
||||
{
|
||||
@ -221,7 +221,7 @@ void FileSearchHandler::handleCreateSearch(Request &req, Response &resp)
|
||||
}
|
||||
|
||||
{
|
||||
RsStackMutex stackMtx(mMtx); // ********** STACK LOCKED MTX **********
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
|
||||
Search& search = mSearches[search_id];
|
||||
search.mStateToken = mStateTokenServer->getNewToken();
|
||||
@ -262,7 +262,7 @@ void FileSearchHandler::handleGetSearchResult(Request& req, Response& resp)
|
||||
}
|
||||
|
||||
{
|
||||
RsStackMutex stackMtx(mMtx); // ********** STACK LOCKED MTX **********
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
std::map<uint32_t, Search>::iterator mit = mSearches.find(id);
|
||||
if(mit == mSearches.end())
|
||||
{
|
||||
|
@ -56,13 +56,13 @@ void FileSharingHandler::notifyListChange(int list, int /* type */)
|
||||
{
|
||||
if(list == NOTIFY_LIST_DIRLIST_LOCAL)
|
||||
{
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx);
|
||||
mStateTokenServer->discardToken(mLocalDirStateToken);
|
||||
mLocalDirStateToken = mStateTokenServer->getNewToken();
|
||||
}
|
||||
else if(list == NOTIFY_LIST_DIRLIST_FRIENDS)
|
||||
{
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx);
|
||||
mStateTokenServer->discardToken(mRemoteDirStateToken);
|
||||
mRemoteDirStateToken = mStateTokenServer->getNewToken();
|
||||
}
|
||||
|
@ -374,7 +374,7 @@ void IdentityHandler::handleAddContact(Request& req, Response& resp)
|
||||
mRsIdentity->setAsRegularContact(RsGxsId(gxs_id), true);
|
||||
|
||||
{
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
mStateTokenServer->replaceToken(mStateToken);
|
||||
}
|
||||
|
||||
@ -389,7 +389,7 @@ void IdentityHandler::handleRemoveContact(Request& req, Response& resp)
|
||||
mRsIdentity->setAsRegularContact(RsGxsId(gxs_id), false);
|
||||
|
||||
{
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
mStateTokenServer->replaceToken(mStateToken);
|
||||
}
|
||||
|
||||
|
@ -267,9 +267,9 @@ PeersHandler::~PeersHandler()
|
||||
|
||||
void PeersHandler::notifyListChange(int list, int /* type */)
|
||||
{
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
if(list == NOTIFY_LIST_FRIENDS)
|
||||
{
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
mStateTokenServer->discardToken(mStateToken);
|
||||
mStateToken = mStateTokenServer->getNewToken();
|
||||
}
|
||||
@ -277,13 +277,13 @@ void PeersHandler::notifyListChange(int list, int /* type */)
|
||||
|
||||
void PeersHandler::notifyPeerStatusChanged(const std::string& /*peer_id*/, uint32_t /*state*/)
|
||||
{
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
mStateTokenServer->replaceToken(mStateToken);
|
||||
}
|
||||
|
||||
void PeersHandler::notifyPeerHasNewAvatar(std::string /*peer_id*/)
|
||||
{
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
mStateTokenServer->replaceToken(mStateToken);
|
||||
}
|
||||
|
||||
@ -295,7 +295,7 @@ void PeersHandler::tick()
|
||||
{
|
||||
mOnlinePeers = online;
|
||||
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
mStateTokenServer->discardToken(mStateToken);
|
||||
mStateToken = mStateTokenServer->getNewToken();
|
||||
}
|
||||
@ -306,7 +306,7 @@ void PeersHandler::tick()
|
||||
{
|
||||
status = statusInfo.status;
|
||||
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
mStateTokenServer->discardToken(mStringStateToken);
|
||||
mStringStateToken = mStateTokenServer->getNewToken();
|
||||
}
|
||||
@ -316,7 +316,7 @@ void PeersHandler::tick()
|
||||
{
|
||||
custom_state_string = custom_state;
|
||||
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
mStateTokenServer->discardToken(mCustomStateToken);
|
||||
mCustomStateToken = mStateTokenServer->getNewToken();
|
||||
}
|
||||
@ -324,7 +324,7 @@ void PeersHandler::tick()
|
||||
|
||||
void PeersHandler::notifyUnreadMsgCountChanged(const RsPeerId &peer, uint32_t count)
|
||||
{
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
mUnreadMsgsCounts[peer] = count;
|
||||
mStateTokenServer->replaceToken(mStateToken);
|
||||
}
|
||||
@ -460,7 +460,7 @@ void PeersHandler::handleWildcard(Request &req, Response &resp)
|
||||
{
|
||||
std::map<RsPeerId, uint32_t> unread_msgs;
|
||||
{
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
unread_msgs = mUnreadMsgsCounts;
|
||||
}
|
||||
std::list<StatusInfo> statusInfo;
|
||||
@ -1281,7 +1281,7 @@ void PeersHandler::handleSetNodeOptions(Request& req, Response& resp)
|
||||
|
||||
StateToken PeersHandler::getCurrentStateToken()
|
||||
{
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
if(mStateToken.isNull())
|
||||
mStateToken = mStateTokenServer->getNewToken();
|
||||
return mStateToken;
|
||||
|
@ -57,7 +57,7 @@ RsControlModule::~RsControlModule()
|
||||
|
||||
bool RsControlModule::processShouldExit()
|
||||
{
|
||||
RsStackMutex stack(mExitFlagMtx);
|
||||
RS_STACK_MUTEX(mExitFlagMtx); // ********** LOCKED **********
|
||||
return mProcessShouldExit;
|
||||
}
|
||||
|
||||
@ -158,7 +158,7 @@ void RsControlModule::run()
|
||||
std::cerr << "RsControlModule::run() reseting passwd." << std::endl;
|
||||
#endif
|
||||
{
|
||||
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
|
||||
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
|
||||
mPassword = "";
|
||||
}
|
||||
|
||||
@ -182,7 +182,7 @@ void RsControlModule::run()
|
||||
std::cerr << "RsControlModule::run() while(wait_for_account_select) mLoadPeerId=" << mLoadPeerId << std::endl;
|
||||
#endif
|
||||
usleep(500*1000);
|
||||
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
|
||||
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
|
||||
|
||||
if(!mLoadPeerId.isNull())
|
||||
{
|
||||
@ -238,7 +238,7 @@ void RsControlModule::run()
|
||||
#endif
|
||||
|
||||
{
|
||||
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
|
||||
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
|
||||
mLoadPeerId.clear();
|
||||
}
|
||||
}
|
||||
@ -247,7 +247,7 @@ void RsControlModule::run()
|
||||
#endif
|
||||
|
||||
{
|
||||
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
|
||||
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
|
||||
mFixedPassword = mPassword;
|
||||
|
||||
std::cerr << "***Reseting mPasswd " << std::endl;
|
||||
@ -279,7 +279,7 @@ void RsControlModule::run()
|
||||
|
||||
void RsControlModule::handleRunState(Request &, Response &resp)
|
||||
{
|
||||
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
|
||||
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
|
||||
std::string state;
|
||||
switch(mRunState)
|
||||
{
|
||||
@ -311,7 +311,7 @@ void RsControlModule::handleRunState(Request &, Response &resp)
|
||||
|
||||
void RsControlModule::handleIdentities(Request &, Response &resp)
|
||||
{
|
||||
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
|
||||
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
|
||||
if(mRunState == WAITING_INIT || mRunState == FATAL_ERROR)
|
||||
{
|
||||
resp.setFail("Retroshare is not initialised. Operation not possible.");
|
||||
@ -337,7 +337,7 @@ void RsControlModule::handleIdentities(Request &, Response &resp)
|
||||
|
||||
void RsControlModule::handleLocations(Request &, Response &resp)
|
||||
{
|
||||
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
|
||||
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
|
||||
if(mRunState == WAITING_INIT || mRunState == FATAL_ERROR)
|
||||
{
|
||||
resp.setFail("Retroshare is not initialised. Operation not possible.");
|
||||
@ -370,7 +370,7 @@ void RsControlModule::handleLocations(Request &, Response &resp)
|
||||
|
||||
void RsControlModule::handlePassword(Request &req, Response &resp)
|
||||
{
|
||||
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
|
||||
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
|
||||
std::string passwd;
|
||||
req.mStream << makeKeyValueReference("password", passwd);
|
||||
if(passwd != "")// && mWantPassword)
|
||||
@ -398,7 +398,7 @@ void RsControlModule::handlePassword(Request &req, Response &resp)
|
||||
|
||||
void RsControlModule::handleLogin(Request &req, Response &resp)
|
||||
{
|
||||
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
|
||||
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
|
||||
if(mRunState != WAITING_ACCOUNT_SELECT)
|
||||
{
|
||||
resp.setFail("Operation not allowed in this runstate. Login is only allowed rigth after initialisation.");
|
||||
@ -411,7 +411,7 @@ void RsControlModule::handleLogin(Request &req, Response &resp)
|
||||
|
||||
void RsControlModule::handleShutdown(Request &, Response &resp)
|
||||
{
|
||||
RsStackMutex stack(mExitFlagMtx); // ********** LOCKED **********
|
||||
RS_STACK_MUTEX(mExitFlagMtx); // ********** LOCKED **********
|
||||
mProcessShouldExit = true;
|
||||
resp.setOk();
|
||||
}
|
||||
@ -514,7 +514,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
|
||||
std::string err_string;
|
||||
// give the password to the password callback
|
||||
{
|
||||
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
|
||||
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
|
||||
mPassword = pgp_password;
|
||||
mFixedPassword = pgp_password;
|
||||
}
|
||||
@ -522,7 +522,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
|
||||
|
||||
// clear fixed password to restore normal password operation
|
||||
// {
|
||||
// RsStackMutex stack(mDataMtx); // ********** LOCKED **********
|
||||
// RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
|
||||
// mFixedPassword = "";
|
||||
// }
|
||||
|
||||
@ -532,7 +532,7 @@ void RsControlModule::handleCreateLocation(Request &req, Response &resp)
|
||||
RsInit::LoadPassword(ssl_password);
|
||||
// trigger login in init thread
|
||||
{
|
||||
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
|
||||
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
|
||||
mLoadPeerId = ssl_id;
|
||||
}
|
||||
resp.mDataStream << makeKeyValueReference("pgp_id", pgp_id)
|
||||
@ -561,7 +561,7 @@ bool RsControlModule::askForDeferredSelfSignature(const void *data, const uint32
|
||||
|
||||
void RsControlModule::setRunState(RunState s, std::string errstr)
|
||||
{
|
||||
RsStackMutex stack(mDataMtx); // ********** LOCKED **********
|
||||
RS_STACK_MUTEX(mDataMtx); // ********** LOCKED **********
|
||||
mRunState = s;
|
||||
mLastErrorString = errstr;
|
||||
mStateTokenServer->replaceToken(mStateToken);
|
||||
|
@ -64,19 +64,19 @@ StateTokenServer::StateTokenServer():
|
||||
|
||||
StateToken StateTokenServer::getNewToken()
|
||||
{
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
return locked_getNewToken();
|
||||
}
|
||||
|
||||
void StateTokenServer::discardToken(StateToken token)
|
||||
{
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
locked_discardToken(token);
|
||||
}
|
||||
|
||||
void StateTokenServer::replaceToken(StateToken &token)
|
||||
{
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
locked_discardToken(token);
|
||||
token = locked_getNewToken();
|
||||
}
|
||||
@ -89,13 +89,13 @@ void StateTokenServer::registerTickClient(Tickable *c)
|
||||
// avoid double registration
|
||||
unregisterTickClient(c);
|
||||
|
||||
RsStackMutex stack(mClientsMtx); /********** STACK LOCKED MTX ***********/
|
||||
RS_STACK_MUTEX(mClientsMtx); // ********** LOCKED **********
|
||||
mTickClients.push_back(c);
|
||||
}
|
||||
|
||||
void StateTokenServer::unregisterTickClient(Tickable *c)
|
||||
{
|
||||
RsStackMutex stack(mClientsMtx); /********** STACK LOCKED MTX ***********/
|
||||
RS_STACK_MUTEX(mClientsMtx); // ********** LOCKED **********
|
||||
std::vector<Tickable*>::iterator vit = std::find(mTickClients.begin(), mTickClients.end(), c);
|
||||
if(vit != mTickClients.end())
|
||||
mTickClients.erase(vit);
|
||||
@ -104,14 +104,14 @@ void StateTokenServer::unregisterTickClient(Tickable *c)
|
||||
void StateTokenServer::handleWildcard(Request &req, Response &resp)
|
||||
{
|
||||
{
|
||||
RsStackMutex stack(mClientsMtx); /********** STACK LOCKED MTX ***********/
|
||||
RS_STACK_MUTEX(mClientsMtx); // ********** LOCKED **********
|
||||
for(std::vector<Tickable*>::iterator vit = mTickClients.begin(); vit != mTickClients.end(); ++vit)
|
||||
{
|
||||
(*vit)->tick();
|
||||
}
|
||||
}
|
||||
|
||||
RsStackMutex stack(mMtx); /********** STACK LOCKED MTX ******/
|
||||
RS_STACK_MUTEX(mMtx); // ********** LOCKED **********
|
||||
// want to lookpup many tokens at once, return a list of invalid tokens
|
||||
// TODO: make generic list serialiser/deserialiser
|
||||
resp.mDataStream.getStreamToMember();
|
||||
|
Loading…
Reference in New Issue
Block a user