-
-
Notifications
You must be signed in to change notification settings - Fork 370
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
Honor client cancel requests in C /C++ code #232
Comments
Fixed this issue for pgr_ksp with commit 5cdd106. |
In the cpp code where it is in a loop that takes a a lot of iterations you need to include THROW_ON_SIGINT
and #include "signalhandler.h" This is a very low cost asynchronous way to check if we got a ^C and the wrapper needs to catch this and inform the C code. You can freely put THROW_ON_SIGINT through out the code and you will get a faster terminate to the ^C |
@woodbri The signal intialization: The include: the cant compile: What am I doing wrong? |
I'm not sure, but maybe the compiler is not scoping the #define in
you could try rewriting L148 to be something like:
and see if that helps. Have the rules for scoping #define objects changed since C++98? |
I dont think scoping rules changed. |
could not make it work :( |
Thank you for following up on this. Its been too long for me to remember the details. Removing from 3.0 is fine. I think to diagnosis this issue in the future we need to trace where if anywhere the signal is getting handled. So for example:
Once this is understood for one command, it should be easy to propagate, so maybe making a dummy command just for testing, that loop 30 times with a sleep(1sec) in the loop would be adequate for testing. |
Check interruption in include/dijkstra Check interruption in include/allpairs Check interruption in include/astar Check interruption in include/dijkstra Check interruption in include/bellman_ford Check interruption in include/breadthFirstSearch Check interruption in include/contraction Check interruption in include/dagShortestPath Check interruption in include/max_flow Check interruption in include/spanningTree Check interruption in include/topologicalSort Check interruption in src/alpha_shape Check interruption in src/components Suppress the -Wconversion warning in src/trsp/trsp.c License ifndef error include Fix cmake Release notes NEWS file Honoring cancellation request (closes pgRouting#232) * allpairs * astar * bellman_ford * breadthFirstSearch * dagShortestPath * dijsktra * contraction * cpp_common * max_flow * spanningTree * topologicalSort * alpha_shape * components * trsp
* allpairs * astar * bellman_ford * breadthFirstSearch * dagShortestPath * dijsktra * contraction * cpp_common * max_flow * spanningTree * topologicalSort * alpha_shape * components * trsp
* allpairs * astar * bellman_ford * breadthFirstSearch * dagShortestPath * dijsktra * contraction * cpp_common * max_flow * spanningTree * topologicalSort * alpha_shape * components * trsp
Currently our C/C++ code does not honor client cancel query requests. There is a macro CHECK_FOR_INTERRUPTS() defined in server/miscadmin.h and we should use that or more likely mimic it so we can check for a pending interrupt in any long running processes, then do clean up and finally call ProcessInterrupts().
We will need to look at how to do this from C++ it might be as simple as wrapping the include like:
The text was updated successfully, but these errors were encountered: