12 #ifndef __UT_Interrupt__
13 #define __UT_Interrupt__
27 #include <sys/types.h>
48 { myBuildMessageCallback = 0; }
50 { myBuildMessageCallback = cb; }
52 { myBuildMessageCallback = cb; myText = str; }
56 if (myCachedText.isstring())
return myCachedText;
57 if (!myBuildMessageCallback)
return myCachedText;
58 myCachedText = myBuildMessageCallback(
this);
108 virtual void busyCheck(
bool interrupted,
110 float longpercent) = 0;
111 virtual void pop() =0;
112 virtual void stop() =0;
114 virtual void interruptAllowed(
bool allowed,
bool allow_ui) =0;
146 PRIORITY_TRANSIENT = 0,
148 PRIORITY_PERMANENT = 2,
158 void setEnabled(
int state,
int print_longtext = 0);
174 bool setInterruptable(
bool allow,
bool *prev_enabled =
nullptr,
175 bool allow_ui =
false);
187 void setAutoInterruptTime(
exint timeout_ms);
196 void clearStickyInterrupts();
198 void setStickyInterrupts();
229 int opStart(
const char *opname = 0,
int npoll = 0,
230 int immediate_dialog=0,
int *opid=0);
231 int opStartPriority(
int priority,
232 const char *opname = 0,
int npoll = 0,
233 int immediate_dialog=0,
int *opid=0);
235 int immediate_dialog = 0,
int *opid = 0);
237 int opInterrupt(
int percent = -1);
239 void opEnd(
int opid=-1);
248 void setLongPercent(
float percent);
253 void setAppTitle(
const char *title);
260 { myActiveCallback =
function; }
273 { ourMemoryThresholdCallback =
function; }
278 { ourEscapeCheckCallback =
function; }
280 {
return ourEscapeCheckCallback; }
289 void pushInterruptCallback(
void (*callback)());
290 void popInterruptCallback();
298 void pause(
bool dopause);
300 bool isPaused()
const;
309 return ourMemoryThresholdCallback
310 ? doTestMemoryThreshold() :
false;
318 return myReadyForInterrupts.canAcquire();
325 myReadyForInterrupts.acquire();
331 const char *getSharedKey()
const;
334 bool doTestMemoryThreshold();
335 void testIdialogInterrupt();
336 void testEscCallbackInterrupt();
338 void updateTitle(
const char *title);
339 void operationComplete();
343 void callInterruptCB();
364 int myTimeoutOpDepth;
366 unsigned char myEnableFlag;
367 unsigned char myEverEnableFlag;
369 short myInterruptedFlag;
370 char myPrintLongTextFlag;
371 bool myInterruptable;
373 bool myInterruptSticky;
376 volatile bool myPaused;
425 bool isInterrupted();
427 void setPercent(
float p);
428 void setLongPercent(
float p);
430 void setMessage(
const char *title);
443 myRunOk = myInterrupt
444 ? (
bool)myInterrupt->opStartPriority(priority, operation_name,
453 myRunOk = myInterrupt
454 ? (
bool)myInterrupt->opStart(operation_name, 0, 0, &myId)
461 myInterrupt->opEnd(myId);
466 if (myRunOk && myInterrupt && myInterrupt->opInterrupt())
473 if (myRunOk && myInterrupt && myInterrupt->opInterrupt(percent))
479 {
return myInterrupt; }
*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)