Correct me if I'm wrong but mutex are not compatible with async functions as it is runned in this case by the Display/main thread, this would not work. I should have renamed the var to semaphore.
The goal here is to make all search requests (character typed) wait for the current search thread to finish. When it does, a signal is sent to all search requests and all are dismissed except the most recent one which is allow to start the search thread.
This avoids creating a thread per keyboard hit. despite I named my variable mutex, there are no critical resources to be protected in the Thread code. I also have and i7 so it won't bother me to have one thread per character but the search could last 1-2 seconds to find in all your history. So having a behaviour similar to "non retriggerable monostable" is likely to be to most performante way to proceed here.
Correct me if I'm wrong but mutex are not compatible with async functions as it is runned in this case by the Display/main thread, this would not work. I should have renamed the var to semaphore.
The goal here is to make all search requests (character typed) wait for the current search thread to finish. When it does, a signal is sent to all search requests and all are dismissed except the most recent one which is allow to start the search thread.
This avoids creating a thread per keyboard hit. despite I named my variable mutex, there are no critical resources to be protected in the Thread code. I also have and i7 so it won't bother me to have one thread per character but the search could last 1-2 seconds to find in all your history. So having a behaviour similar to "non retriggerable monostable" is likely to be to most performante way to proceed here.
Still making some cleanup as possible although