Made wxLogXXX() functions thread-safe.
They can now be called from any thread and will buffer the messages until the current log target is flushed from the main thread. This makes earlier code to do the same thing specifically for wxLogWindow unnecessary and also allows to use wxLogMessage() in the thread sample instead of using manual logging there. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@61416 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -258,5 +258,20 @@ automatically switches to using wxLogStderr if it isn't.
|
||||
The dialog sample illustrates this approach by defining a custom log target
|
||||
customizing the dialog used by wxLogGui for the single messages.
|
||||
|
||||
|
||||
@section overview_log_mt Logging in Multi-Threaded Applications
|
||||
|
||||
Starting with wxWidgets 2.9.1, logging functions can be safely called from any
|
||||
thread. Messages logged from threads other than the main one will be buffered
|
||||
until wxLog::Flush() is called in the main thread (which usually happens during
|
||||
idle time, i.e. after processing all pending events) and will be really output
|
||||
only then. Notice that the default GUI logger already only output the messages
|
||||
when it is flushed, so by default messages from the other threads will be shown
|
||||
more or less at the same moment as usual. However if you define a custom log
|
||||
target, messages may be logged out of order, e.g. messages from the main thread
|
||||
with later timestamp may appear before messages with earlier timestamp logged
|
||||
from other threads. wxLog does however guarantee that messages logged by each
|
||||
thread will appear in order in which they were logged.
|
||||
|
||||
*/
|
||||
|
||||
|
Reference in New Issue
Block a user