3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-05-07 07:45:46 +00:00
z3/src/util/cancel_eh.h
Leonardo de Moura 607fab486c Fix incorrect uses of set_cancel()
Signed-off-by: Leonardo de Moura <leonardo@microsoft.com>
2012-12-17 18:48:10 -08:00

38 lines
628 B
C++

/*++
Copyright (c) 2011 Microsoft Corporation
Module Name:
cancel_eh.h
Abstract:
Template for implementing simple event handler that just invokes cancel method.
Author:
Leonardo de Moura (leonardo) 2011-04-27.
Revision History:
--*/
#ifndef _CANCEL_EH_H_
#define _CANCEL_EH_H_
#include"event_handler.h"
/**
\brief Generic event handler for invoking cancel method.
*/
template<typename T>
class cancel_eh : public event_handler {
T & m_obj;
public:
cancel_eh(T & o):m_obj(o) {}
~cancel_eh() { m_obj.reset_cancel(); }
virtual void operator()() {
m_obj.cancel();
}
};
#endif