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

Consider removing lock.rs or similar. #8

Open
Lymia opened this issue Jul 14, 2019 · 1 comment
Open

Consider removing lock.rs or similar. #8

Lymia opened this issue Jul 14, 2019 · 1 comment

Comments

@Lymia
Copy link

Lymia commented Jul 14, 2019

This appears to be related to synchronizing multiple processes trying to write output at once, which is likely a rare use case for non-rustc code. At minimum, there should probably be support for renaming the mutex to something other than rustc_errors.

@kevinmehall
Copy link
Owner

One could imagine wanting this for a compiler called from a Makefile or a tool like Cargo that runs multiple invocations in parallel.

However, this lock is only relevant on Windows prior to 10 where it needs to make system calls to change colors, otherwise it can rely on the atomicity of write() to dump an ANSI-formatted buffer atomically. This doesn't seem worth having unsafe code for. If a program that uses this library really needs the functionality on older versions of Windows, it can wrap calls to emit with its own lock based on this or other code.

I think we can also get rid of Destination::Terminal and its Windows-specific code because this should be handled by termcolor.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants