libsmt.rs icon indicating copy to clipboard operation
libsmt.rs copied to clipboard

Set timeout for read()

Open sushant94 opened this issue 8 years ago • 3 comments

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.

sushant94 avatar Mar 02 '16 20:03 sushant94

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?

chinmaydd avatar May 25 '17 11:05 chinmaydd

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.

sushant94 avatar May 26 '17 19:05 sushant94

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.

chinmaydd avatar Jun 02 '17 18:06 chinmaydd