12 #ifndef __UT_Interrupt__
13 #define __UT_Interrupt__
27 #include <sys/types.h>
53 if (myCachedText.isstring())
return myCachedText;
54 if (!myBuildMessageCallback)
return myCachedText;
55 myCachedText = myBuildMessageCallback(
this);
105 virtual void busyCheck(
bool interrupted,
107 float longpercent) = 0;
108 virtual void pop() =0;
109 virtual void stop() =0;
111 virtual void interruptAllowed(
bool allowed,
bool allow_ui) =0;
143 PRIORITY_TRANSIENT = 0,
145 PRIORITY_PERMANENT = 2,
155 void setEnabled(
int state,
int print_longtext = 0);
171 bool setInterruptable(
bool allow,
bool *prev_enabled =
nullptr,
172 bool allow_ui =
false);
184 void clearStickyInterrupts();
186 void setStickyInterrupts();
217 int opStart(
const char *opname = 0,
int npoll = 0,
218 int immediate_dialog=0,
int *opid=0);
219 int opStartPriority(
int priority,
const char *opname = 0,
int npoll = 0,
220 int immediate_dialog=0,
int *opid=0);
221 int opStartMessage(
int priority,
const UT_InterruptMessage &msg,
int immediate_dialog = 0,
int *opid = 0);
223 int opInterrupt(
int percent = -1);
225 void opEnd(
int opid=-1);
234 void setLongPercent(
float percent);
239 void setAppTitle(
const char *title);
246 { myActiveCallback =
function; }
259 { ourMemoryThresholdCallback =
function; }
264 { ourEscapeCheckCallback =
function; }
266 {
return ourEscapeCheckCallback; }
275 void pushInterruptCallback(
void (*callback)());
276 void popInterruptCallback();
284 void pause(
bool dopause);
286 bool isPaused()
const;
295 return ourMemoryThresholdCallback
296 ? doTestMemoryThreshold() :
false;
304 return myReadyForInterrupts.canAcquire();
311 myReadyForInterrupts.acquire();
317 const char *getSharedKey()
const;
320 bool doTestMemoryThreshold();
321 void testIdialogInterrupt();
322 void testEscCallbackInterrupt();
324 void updateTitle(
const char *title);
325 void operationComplete();
329 void callInterruptCB();
350 unsigned char myEnableFlag;
351 unsigned char myEverEnableFlag;
353 short myInterruptedFlag;
354 char myPrintLongTextFlag;
355 bool myInterruptable;
357 bool myInterruptSticky;
360 volatile bool myPaused;
409 bool isInterrupted();
411 void setPercent(
float p);
412 void setLongPercent(
float p);
414 void setMessage(
const char *title);
427 myRunOk = myInterrupt
428 ? (bool)myInterrupt->opStartPriority(priority, operation_name,
437 myRunOk = myInterrupt
438 ? (bool)myInterrupt->opStart(operation_name, 0, 0, &myId)
445 myInterrupt->opEnd(myId);
450 if (myRunOk && myInterrupt && myInterrupt->opInterrupt())
457 if (myRunOk && myInterrupt && myInterrupt->opInterrupt(percent))
*pool push(my_func, arg1,...)
UT_Interrupt * getInterrupt() const
#define SYS_DEPRECATED(__V__)
volatile char myLongMessage[128]
static bool getIsEscapeCheckCallbackSet()
void(* OPUI_UpdateModeCB)()
void setActiveCallback(UT_InterruptCB function)
bool(* UI_CheckForEscapeCB)()
void setInterruptHandler(UT_InterruptHandler *hand)
UT_InterruptMessage(UT_InterruptMessageCB cb, const UT_StringHolder &str)
const UT_StringHolder & buildMessage() const
UT_AutoInterrupt(const char *operation_name, UT_Interrupt *boss=UTgetInterrupt())
void(* UT_InterruptCB)(UT_Interrupt *me, int state, const char *op)
UT_InterruptMessage(UT_InterruptMessageCB cb)
#define SYS_NO_DISCARD_RESULT
volatile float myLongPercent
bool stickyInterrupts() const
virtual void interruptAllowed(bool allowed, bool allow_ui)=0
static void setUpdateModeCallback(OPUI_UpdateModeCB function)
static void setEscapeCheckCallback(UI_CheckForEscapeCB function)
bool getInterruptable() const
UT_AutoInterrupt(const char *operation_name, UT_Interrupt::Priority priority, UT_Interrupt *boss=UTgetInterrupt())
bool readyForInterrupts() const
LeafData & operator=(const LeafData &)=delete
UT_API UT_Interrupt * UTgetInterrupt()
Obtain global UT_Interrupt singleton.
volatile char myMessage[128]
UT_API void UTsetInterrupt(UT_Interrupt *)
volatile int myNumMessages
void pause(int delay) noexcept
UT_Lock & getInterruptableLock()
void(* UTsigHandler)(UTsignalHandlerArg)
UT_InterruptHandler * getInterruptHandler()
bool wasInterrupted(int percent)
UT_StringHolder getAppTitle() const
bool testMemoryThreshold()
void delayNextInterrupt()
UT_StringHolder(* UT_InterruptMessageCB)(const UT_InterruptMessage *me)