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

method of pulling output is painful #19

Open
Anniepoo opened this issue May 8, 2016 · 1 comment
Open

method of pulling output is painful #19

Anniepoo opened this issue May 8, 2016 · 1 comment

Comments

@Anniepoo
Copy link
Member

Anniepoo commented May 8, 2016

Having the httpRequest for pull_response wait until there is some is painful.

See for example the code

          if (proof.getNearestInt("X") < 3) {  // change this to a larger number to see it hang
              // this hangs on the last proof
              // This is referred to in https://github.com/SWI-Prolog/pengines/issues/19
              String out = io.getOutput();
              if(out != null) {
                  System.out.println("I got " + out + " from the server");
              }
          }

in ManualAsk.java in JavaPengines.

Am I off in the weeds here, or is this just painful?

@JanWielemaker
Copy link
Member

There is little choice given the one-direction HTTP protocol. So, if you get a server response, it may either be a binding or output (or destroy, ...) You can handle this all quite well using event based programming. If you want a waiting loop, it might be an idea to install a callback for handling output.

This, if I understood your question ok ...

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

No branches or pull requests

2 participants