Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add hpx::iostreams::ostream overload to format_to #3174

Merged
merged 2 commits into from Feb 17, 2018

Conversation

msimberg
Copy link
Contributor

@msimberg msimberg commented Feb 15, 2018

Fixes #3013.

Proposed Changes

  • Adds an overload to hpx::util::format_to taking a hpx::iostreams::ostream to make sure that the correct operators (<<) are called.

Any background context you want to provide?

When a hpx::iostreams::ostream is used as a std::ostream the correct virtual functions are not called, thus bypassing locks that are supposed to be taken in the hpx::iostreams::ostream implementation (base class functions are not virtual?). A proper fix would make sure the correct functions are called, but at the moment I have no fix for that.

"Fixes" problem of the hpx::iostreams::ostream << operator not being called when
the hpx::iostreams::ostream is used as a std::ostream.
@msimberg msimberg changed the title Fix format to Add hpx::iostreams::ostream overload to format_to Feb 15, 2018
@hkaiser
Copy link
Member

hkaiser commented Feb 15, 2018

For the records, the actual problem is that hpx::cout has it's own operator<<(T) that does the locking (see https://github.com/STEllAR-GROUP/hpx/blob/master/hpx/components/iostreams/ostream.hpp#L330-L335). This operator will not be invoked if the stream is used through its std::ostream base class. This should be fixed by a separate PR (see ticket #3175).

Copy link
Member

@hkaiser hkaiser left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is good enough as a workaround but the underlying issue needs separate fixing.

@hkaiser hkaiser added this to the 1.1.0 milestone Feb 15, 2018
@hkaiser hkaiser merged commit 2e3ed96 into STEllAR-GROUP:master Feb 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

hello_world occasionally prints multiple lines from a single OS-thread
2 participants