Skip to content

Commit bad1c79

Browse files
committed
Fixed duplicated symbols for domain initializer. (Thanks to Dominik for reporting the bug.)
1 parent 4538dd9 commit bad1c79

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

include/react/Domain.h

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,16 @@ void AsyncTransaction(TransactionFlagsT flags, TransactionStatus& status, F&& fu
428428
#define REACTIVE_DOMAIN(name, ...) \
429429
struct name : \
430430
public REACT_IMPL::DomainBase<name, REACT_IMPL::DomainPolicy< __VA_ARGS__ >> {}; \
431-
REACT_IMPL::DomainInitializer<name> name ## _initializer_;
431+
static REACT_IMPL::DomainInitializer<name> name ## _initializer_;
432+
433+
/*
434+
A brief reminder why the domain initializer is here:
435+
Each domain has a couple of singletons (debug log, engine, input manager) which are
436+
currently implemented as meyer singletons. From what I understand, these are thread-safe
437+
in C++11, but not all compilers implement that yet. That's why a static initializer has
438+
been added to make sure singleton creation happens before any multi-threaded access.
439+
This implemenation is obviously inconsequential.
440+
*/
432441

433442
///////////////////////////////////////////////////////////////////////////////////////////////////
434443
/// Define type aliases for given domain

0 commit comments

Comments
 (0)