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-unsafe call of reader_interrupted() in wildcard_expand_internal() #537
Comments
Question: is there currently any way in which an autocompletion thread can be notified that its service is no longer needed? That would probably be desirable if e.g. a slow wildcard is being searched for for an autocompletion and then the user types another key which makes the autocompletion irrelevant. |
We do have a generation count in reader.cpp, but it's used only for an early exit when an autosuggestion thread is started. It's not used once the thread is already running. That would be a nice thing to add. It would not necessarily be too hard. You would propagate the the gen count at the time the thread started throughout the call to |
I did an implementation in branch Problems: thread local storage with the Problem 2: I copied a configure check for TLS from a gnu repository, but it's GPLv3+, so I think it's incompatible with fish. Maybe there's some loophole as output of Is there any way to make threadlocal storage work on platorms we care about? |
AFAIK, thread local storage is not supported at all on OS X. This is because it requires changes to the executable format (thread-local sections), as well as the compiler and linker. I do not know the TLS status on *BSD, but I am not optimistic. OS X has Yet another possibility is to use Also, is it really intractable to pass some data explicitly, all the way down? That would be cleanest. |
Using I opted for tls in this branch because it was easiest to do as a first approach. Tls also seems to me to be the "right thing" in this case, if it weren't for the portability difficulties. So my preference would be to use |
I've implemented a version using by the way, I was planning on merging |
pthread_setspecific is OK to rely on. Changes in both those branches look great! I'll leave it to your discretion how you merge. My only suggestion is to rename Thanks! |
fixed with the merge in 9a89da3. (d9d8bfa should be ignored) |
This bug is a spinoff from bug #516.
wildcard_expand_internal
is called both on the main thread when executing a command with wildcards, and on background threads when searching for autocompletions.reader_interrupted
should not be called on background threads.The text was updated successfully, but these errors were encountered: