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

thread-safe or not? #17

Closed
petamem opened this issue Sep 13, 2016 · 2 comments
Closed

thread-safe or not? #17

petamem opened this issue Sep 13, 2016 · 2 comments

Comments

@petamem
Copy link

petamem commented Sep 13, 2016

Could you please confirm that Term::ReadKey is or is not thread-safe?
I experience quite a lot of crashes of Term::ReadKey 2.33 in a forking environment under Windows.

@jonathanstowe
Copy link
Owner

The module is not designed with thread safety in mind, (it pre-dates threading in Perl and fork emulation on Windows,) so it would be fairly safe to assume it won't play nicely in a threaded environment.

Specifically the XS parts of the module make calls to functions in the system C library which are probably not re-entrant in most implementations, and there are several static "global" variables in the XS code itself that are used to retain state which would also militate against its being "thread-safe"..

While it would be theoretically possible to make a module that does what Term::ReadKey does in a more thread-safe manner, it would almost certainly have to be a new and separate module as it would need a completely different interface style

@jonathanstowe
Copy link
Owner

I'm going to close this as I guess the above answers the question.

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

No branches or pull requests

2 participants