Add runstate swap helpers
[fio.git] / libfio.c
index f4aac2efb739c6910ca37cb046e6f2ad053c00d2..8eddab80b345651f11533038963bb03e5bc0ff93 100644 (file)
--- a/libfio.c
+++ b/libfio.c
@@ -172,6 +172,19 @@ void td_set_runstate(struct thread_data *td, int runstate)
        td->runstate = runstate;
 }
 
+int td_bump_runstate(struct thread_data *td, int new_state)
+{
+       int old_state = td->runstate;
+
+       td_set_runstate(td, new_state);
+       return old_state;
+}
+
+void td_restore_runstate(struct thread_data *td, int old_state)
+{
+       td_set_runstate(td, old_state);
+}
+
 void fio_terminate_threads(int group_id)
 {
        struct thread_data *td;