-
Notifications
You must be signed in to change notification settings - Fork 152
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
Make ios_system thread-safe #30
Comments
global_errno, which I use to return error codes from the commands, would also have to be made thread-local. That would also create practical issues. |
I'll need to replace it with another mechanism to make sure each tab has only one "main thread". |
Request for comment: There is a data structure ( I maintain a NSMutableDictionary of these structures, indexed by the value of In preliminary tests, it seems to be working: ctrl-C in a tab closes the command in that tab, not in the other one. Commands are running in parallel in the different tabs ( Systems that don't define API changes:
@yury, @IMcD23 and @louisdh : do you have comments on this potential change? It's working, but I can still change things based on your input. (it also outputs a lot of debugging information on screen right now; I'll remove that before the global release). |
@yury: the renaming is done. About NSFileManager, I'm reading the docs to make sure I do it right. @louisdh: currently OpenTerm does not start a command while another command is running. Test: start There is also the issue of |
@yury: I have a small issue with auto-complete when we switch tabs: the currentDirectory is not set to that of the current tab until the first command is executed. That confuses auto-complete, which displays the list of files in the previous tab current directory. Is there a command that is execute whenever we swith to another tab? |
There is no such command in session. But you can create one and call it from TermController#focus |
Update: commit be8524b (in experimental) creates new instances of Oh, and the multiple debug prints have been removed. |
Update (again): indexing by
Commit ece3ee1 of https://github.com/holzschu/terminal and 70cc53e of https://github.com/holzschu/blink/tree/thread-utils use the new API. |
As requested by @yury and @IMcD23 : ios_system() should be made thread-safe, allowing people to launch commands in multiple tabs.
This is not trivial, since making
current_command_root_thread
a thread-local variable results in it not being set in most threads, andios_kill()
having no thread ID available to kill.Ideally, I'd like an implementation that is compatible with current applications.
Making ios_system itself thread-safe will leave the issue of some commands being not thread-safe themselves (2 "python" in separate tabs will almost certainly not work).
The text was updated successfully, but these errors were encountered: