sushant94 / libsmt.rs

Rust Bindings to interact with SMTLIB2 compliant solvers
Apache License 2.0
16 stars 12 forks source link

Set timeout for read() #6

Open sushant94 opened 8 years ago

sushant94 commented 8 years ago

The current implementation waits indefinitely to read from the process pipe. It would be nice to have a configurable option to set a timeout for read from the solvers.

chinmaydd commented 7 years ago

There is no direct timeout/wait method implemented for the ChildStdout struct which we are using for reading from the process. One way to solve this problem would be using a thread which is made to sleep for a certain duration and then the output can be checked if it is generated or we can move to other libraries such as subprocess (which is a wrapper around Process/Child but with the API resembling the Python subprocess) to ease out the process. Thoughts?

sushant94 commented 7 years ago

Ok, we don't want the thread to wait if the output is already generated. From what I understand, your first solution will force the thread to sleep for n milli-seconds (or whatever) regardless of the output being generated before. If you can avoid this, then the solution seems fine.

chinmaydd commented 7 years ago

Having managed a way to set a timeout, is it advisable to change the solve and check_sat methods since it will break the current API? I thought maybe we could have a solve_with_timeout instead.