top of page
worker_2_software.png

Screen Writer

worker_2_software.png

In many applications, there is a need to display messages or errors on the screen, and in C++ usually std::cout is used. However, in a multi-thread environment the screen is a shared resource, and different threads might try to display messages simultaneously. Although std::cout is thread safe and does handle such requests, developers might have noticed that sometimes it mixes messages on the screen. 

 

For instance, if two threads try to display "Hello world.", developers might occasionally see 
Hello Hello world. world.
instead of
Hello world. Hello world.
 

This library helps avoiding such cases by regulating the flow of messages. Note that the class is designed as a singleton, i.e., it is globally accessible, and developers can record messages from anywhere from their application. 

bottom of page