File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -75,6 +75,7 @@ cc_test(
75
75
"//hpb_generator/tests:test_model_hpb_proto" ,
76
76
"//upb/mem" ,
77
77
"//upb/mini_table" ,
78
+ "@abseil-cpp//absl/base:core_headers" ,
78
79
"@abseil-cpp//absl/hash" ,
79
80
"@abseil-cpp//absl/log:absl_check" ,
80
81
"@googletest//:gtest" ,
Original file line number Diff line number Diff line change 13
13
#include < thread>
14
14
15
15
#include < gtest/gtest.h>
16
+ #include " absl/base/thread_annotations.h"
16
17
#include " absl/hash/hash.h"
17
18
#include " absl/log/absl_check.h"
18
19
#include " hpb_generator/tests/test_model.hpb.h"
@@ -49,8 +50,13 @@ std::string GenerateTestData() {
49
50
}
50
51
51
52
std::mutex m[8 ];
52
- void unlock_func (const void * msg) { m[absl::HashOf (msg) & 0x7 ].unlock (); }
53
- ::hpb::internal::UpbExtensionUnlocker lock_func (const void * msg) {
53
+ void unlock_func (const void * msg)
54
+ ABSL_UNLOCK_FUNCTION(m[absl::HashOf(msg) & 0x7]) {
55
+ m[absl::HashOf (msg) & 0x7 ].unlock ();
56
+ }
57
+
58
+ ::hpb::internal::UpbExtensionUnlocker lock_func (const void * msg)
59
+ ABSL_EXCLUSIVE_LOCK_FUNCTION(m[absl::HashOf(msg) & 0x7]) {
54
60
m[absl::HashOf (msg) & 0x7 ].lock ();
55
61
return &unlock_func;
56
62
}
You can’t perform that action at this time.
0 commit comments