Skip to content

Commit

Permalink
Make WinToast::Instance() thread local
Browse files Browse the repository at this point in the history
With this, the Instance method returns a thread local instance, instead
of a global instance.
This allows using the method inside multi-threaded programs.

Without the *thread_local* keyword, creating a toast inside another
thread then the instanciating thread will throw an exception, because
the combaselib does not support operation across threads.
  • Loading branch information
HeinrichZurHorstMeyer committed Apr 2, 2024
1 parent 277c0fb commit ee10d0c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/wintoastlib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ namespace Util {
} // namespace Util

WinToast* WinToast::instance() {
static WinToast instance;
thread_local static WinToast instance;
return &instance;
}

Expand Down

0 comments on commit ee10d0c

Please sign in to comment.