Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 09d6627

Browse files
committed
adds FML_GUARDED_BY
1 parent 07935ac commit 09d6627

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

fml/concurrent_message_loop.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,9 @@ class ConcurrentTaskRunner : public BasicTaskRunner {
7373
private:
7474
friend ConcurrentMessageLoop;
7575

76-
// Raw pointer that is cleared out in ~ConcurrentMessageLoop.
77-
ConcurrentMessageLoop* weak_loop_;
7876
std::mutex weak_loop_mutex_;
77+
// Raw pointer that is cleared out in ~ConcurrentMessageLoop.
78+
ConcurrentMessageLoop* weak_loop_ FML_GUARDED_BY(weak_loop_mutex_);
7979

8080
FML_DISALLOW_COPY_AND_ASSIGN(ConcurrentTaskRunner);
8181
};

fml/macros.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,4 +38,12 @@
3838
TypeName() = delete; \
3939
FML_DISALLOW_COPY_ASSIGN_AND_MOVE(TypeName)
4040

41+
#if defined(__clang__)
42+
#define FML_THREAD_ANNOTATION_ATTRIBUTE__(x) __attribute__((x))
43+
#else
44+
#define FML_THREAD_ANNOTATION_ATTRIBUTE__(x) // no-op
45+
#endif
46+
47+
#define FML_GUARDED_BY(x) FML_THREAD_ANNOTATION_ATTRIBUTE__(guarded_by(x))
48+
4149
#endif // FLUTTER_FML_MACROS_H_

0 commit comments

Comments
 (0)