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

Implement picosat_set_interrupt #27

Open
wkschwartz opened this issue Jan 4, 2017 · 2 comments
Open

Implement picosat_set_interrupt #27

wkschwartz opened this issue Jan 4, 2017 · 2 comments
Milestone

Comments

@wkschwartz
Copy link
Owner

Allow users to set custom interrupt functions as well as providing default time and signal-based (e.g., Ctrl+C) ones.

picosat.h doesn't say it, but the interrupt function should return non-zero when it's time for picosat_sat to give up and zero if it can keep going. The external_state should be a pointer to some Go object that the Go interrupt function can read for information about what it's supposed to do. May need some C type casting to allow this.

@wkschwartz wkschwartz modified the milestone: v1.1 Jan 4, 2017
@wkschwartz
Copy link
Owner Author

wkschwartz commented Jan 20, 2017

Is there any way to use the Context type. Perhaps we pass a Context object to a new method SolveInContext (but not just to Solve, which would violate the backward compatibility promise; the context package says Context objects should always be passed to every function that uses one rather than stored in a struct).

@wkschwartz
Copy link
Owner Author

A user could not use picosat_set_interrupt more than once concurrently. We'll have to be careful to serialize access to it. Otherwise a timer going off (for example) for one Solve call would end all Solve calls. This may automatically be taken care of by way of Solve's use of a write lock.

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

No branches or pull requests

1 participant