diff options
author | Ed Maste <emaste@FreeBSD.org> | 2014-11-25 21:00:58 +0000 |
---|---|---|
committer | Ed Maste <emaste@FreeBSD.org> | 2014-11-25 21:00:58 +0000 |
commit | 0cac4ca3916ac24ab6139d03cbfd18db9e715bfe (patch) | |
tree | c94307da318be46e5aeea1a325c1e91749506e4f /source/Target/SectionLoadHistory.cpp | |
parent | 03b99097822ca3ac69252d9afae716a584ed56c4 (diff) |
Notes
Diffstat (limited to 'source/Target/SectionLoadHistory.cpp')
-rw-r--r-- | source/Target/SectionLoadHistory.cpp | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/source/Target/SectionLoadHistory.cpp b/source/Target/SectionLoadHistory.cpp index 527168ce42af..1e5c4175a2bf 100644 --- a/source/Target/SectionLoadHistory.cpp +++ b/source/Target/SectionLoadHistory.cpp @@ -47,15 +47,7 @@ SectionLoadHistory::GetLastStopID() const SectionLoadList * SectionLoadHistory::GetSectionLoadListForStopID (uint32_t stop_id, bool read_only) { - if (m_stop_id_to_section_load_list.empty()) - { - SectionLoadListSP section_load_list_sp(new SectionLoadList()); - if (stop_id == eStopIDNow) - stop_id = 0; - m_stop_id_to_section_load_list[stop_id] = section_load_list_sp; - return section_load_list_sp.get(); - } - else + if (!m_stop_id_to_section_load_list.empty()) { if (read_only) { @@ -65,7 +57,7 @@ SectionLoadHistory::GetSectionLoadListForStopID (uint32_t stop_id, bool read_onl if (stop_id == eStopIDNow) { // If we are asking for the latest and greatest value, it is always - // at the end of our list becuase that will be the highest stop ID. + // at the end of our list because that will be the highest stop ID. StopIDToSectionLoadList::reverse_iterator rpos = m_stop_id_to_section_load_list.rbegin(); return rpos->second.get(); } @@ -105,13 +97,18 @@ SectionLoadHistory::GetSectionLoadListForStopID (uint32_t stop_id, bool read_onl return section_load_list_sp.get(); } } - return NULL; + SectionLoadListSP section_load_list_sp(new SectionLoadList()); + if (stop_id == eStopIDNow) + stop_id = 0; + m_stop_id_to_section_load_list[stop_id] = section_load_list_sp; + return section_load_list_sp.get(); } SectionLoadList & SectionLoadHistory::GetCurrentSectionLoadList () { const bool read_only = true; + Mutex::Locker locker(m_mutex); SectionLoadList *section_load_list = GetSectionLoadListForStopID (eStopIDNow, read_only); assert(section_load_list != NULL); return *section_load_list; |