Skip to content

Commit

Permalink
Merge pull request sonic-net#219 from kcudnik/getlock
Browse files Browse the repository at this point in the history
Add lock for get response
  • Loading branch information
yxieca authored Sep 6, 2017
2 parents 5573138 + cfbda81 commit 257b139
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions syncd/syncd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,9 @@ void internal_syncd_get_send(
// since we have only one get at a time, we don't have to serialize
// object type and object id, only get status is required
// get response will not put any data to table only queue is used

std::lock_guard<std::mutex> lock(g_db_mutex);

getResponse->set(key, entry, "getresponse");

SWSS_LOG_INFO("response for GET api was send");
Expand Down Expand Up @@ -981,6 +984,8 @@ void sendResponse(sai_status_t status)

SWSS_LOG_NOTICE("sending response: %s", str_status.c_str());

std::lock_guard<std::mutex> lock(g_db_mutex);

getResponse->set(str_status, entry, "notify");
}

Expand Down

0 comments on commit 257b139

Please sign in to comment.