-
Notifications
You must be signed in to change notification settings - Fork 128
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CONSOLE] Console redirect should not be handled by the Thunder Resou…
…rceMonitor. (#1494) As the Console stream redirecting is writing data to filebuffers, the file buffers might block as the buffer is full and first nees to be flushed. However if this happens while code is being executed on the ResourceMonitor thread it create a clissical deadlock. This use-case was observed by TRACE_LX macros that use a printf (to stderr) to write data to the console. In case of redirection, this is done to the intermediate file descriptor. If this intermediate file descriptor can not continue to write (as the buffer is full) the printf (to stderr) will block, witing for the data to be read so new buffer space becomes avaialble. However the readin of this data has to be doen by this ResourceMonitor thread which is currently blocked by this printf. To avoid this classical deadlock, the StreamRedirectType template now uses its own instantiation of the ResourceMonitor. As this ResourceMonitor will only be used by (best case) 2 descriptors (stdout and stderr) enhanced the template to control the number of descriptors it expects and the Stack size required by these threads.
- Loading branch information
Showing
2 changed files
with
105 additions
and
94 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.