MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / runThread

Function runThread

ui/progresstask.h:308–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

306 BackgroundThread(QObject* owner) : QObject(), m_owner(owner), m_hasOwner(owner != nullptr), m_finished(false), m_exception() {}
307
308 void runThread()
309 {
310 QVariant value = m_init;
311 try
312 {
313 for (auto& func : m_then)
314 {
315 if (m_hasOwner && m_owner.isNull())
316 return;
317 switch (func.first)
318 {
319 case MainThread:
320 BinaryNinja::ExecuteOnMainThreadAndWait([&]() {
321 if (m_hasOwner && m_owner.isNull())
322 return;
323 value = func.second(value);
324 });
325 break;
326 case Background:
327 value = func.second(value);
328 break;
329 }
330 }
331 for (auto& func : m_finally)
332 {
333 if (m_hasOwner && m_owner.isNull())
334 return;
335 try
336 {
337 switch (func.first)
338 {
339 case MainThread:
340 BinaryNinja::ExecuteOnMainThreadAndWait([&]() {
341 if (m_hasOwner && m_owner.isNull())
342 return;
343 func.second(true);
344 });
345 break;
346 case Background:
347 func.second(true);
348 break;
349 }
350 }
351 // Since we're already in the finally blocks, we can't reverse back to the catch blocks
352 // Just print an error and keep going
353 catch (std::exception& e)
354 {
355 BinaryNinja::LogError("Exception thrown in BackgroundThread::finally(): %s", e.what());
356 }
357 catch (...)
358 {
359 BinaryNinja::LogError("Exception thrown in BackgroundThread::finally()");
360 }
361 }
362 triggerDone(value);
363 }
364 catch (...)
365 {

Callers 1

startFunction · 0.85

Calls 5

triggerDoneFunction · 0.85
triggerFailFunction · 0.85
isNullMethod · 0.80
secondMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected