diff options
author | susi_su <susisu@google.com> | 2022-09-21 23:26:37 +0800 |
---|---|---|
committer | susi_su <susisu@google.com> | 2022-10-03 21:59:13 +0800 |
commit | 85245b2282243ae54cd1273a221f3df112d5c890 (patch) | |
tree | 4734eb363c6df5a7d758058ff7cbd1e754c93ed1 /histogram | |
parent | 6d9cb1744e8dbaa7304372e8f26df38c20e301e4 (diff) | |
download | gs201-85245b2282243ae54cd1273a221f3df112d5c890.tar.gz |
libhw2.1: change mIDLHistogram to shared_ptr
change mIDLHistogram to shared_ptr to avoid
memory error when destructing ExynosDisplayDrmInterfaceModule
add lock when dealing with roi, weights, threshold
to avoid race between set and use of these data
bug: b/240292495
test: tested by a histogram client program locally
Change-Id: I065239c2bc7d5edfa37e96f04c016da51ebed76f
Diffstat (limited to 'histogram')
-rw-r--r-- | histogram/histogram.h | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/histogram/histogram.h b/histogram/histogram.h index ff981bf..a7b41ce 100644 --- a/histogram/histogram.h +++ b/histogram/histogram.h @@ -28,8 +28,14 @@ class IDLHistogram : public HistogramInfo { public: IDLHistogram() : HistogramInfo(HistogramType::HISTOGRAM_HIDL) {} virtual ~IDLHistogram() {} - virtual void setHistogramPos(HistogramPos pos) { mHistogramPos = pos; } - HistogramPos getHistogramPos() { return mHistogramPos; } + virtual void setHistogramPos(HistogramPos pos) { + std::unique_lock<std::mutex> lk(mSetHistInfoMutex); + mHistogramPos = pos; + } + HistogramPos getHistogramPos() { + std::unique_lock<std::mutex> lk(mSetHistInfoMutex); + return mHistogramPos; + } private: HistogramPos mHistogramPos = HistogramPos::POST; |