KSquare Utilities
KKThread.cpp File Reference
#include "FirstIncludes.h"
#include <fstream>
#include <iostream>
#include <map>
#include <ostream>
#include <string>
#include <vector>
#include "MemoryDebug.h"
#include "KKBaseTypes.h"
#include <windows.h>
#include "KKException.h"
#include "MsgQueue.h"
#include "OSservices.h"
#include "KKThread.h"

Go to the source code of this file.

Classes

struct  tagTHREADNAME_INFO
 

Macros

#define MS_VC_EXCEPTION   0x406D1388
 

Typedefs

typedef struct tagTHREADNAME_INFO THREADNAME_INFO
 

Functions

unsigned int ThreadStartCallBack (void *param)
 

Macro Definition Documentation

#define MS_VC_EXCEPTION   0x406D1388

Definition at line 35 of file KKThread.cpp.

Typedef Documentation

Function Documentation

unsigned int ThreadStartCallBack ( void *  param)

Definition at line 280 of file KKThread.cpp.

References KKB::KKStr::Concat(), KKB::KKThread::Crashed(), KKB::KKThread::ExceptionText(), KKB::KKThread::Run(), KKB::KKThread::Starting, KKB::KKThread::Status(), KKB::KKThread::Stopped, and KKB::KKException::ToString().

281  {
282  KKThreadPtr tp = (KKThreadPtr)param;
283  tp->Status (KKThread::ThreadStatus::Starting);
284  try
285  {
286  tp->Run ();
287  }
288  catch (const KKException& e1)
289  {
290  tp->Crashed (true);
291  tp->ExceptionText (e1.ToString ());
292  }
293  catch (const std::exception e2)
294  {
295  tp->Crashed (true);
296  const char* e2What = e2.what ();
297  KKStr msg (30 + strlen (e2What));
298  msg << "std::exception: " << e2What;
299  tp->ExceptionText (msg);
300  }
301  catch (...)
302  {
303  tp->Crashed (true);
304  tp->ExceptionText ("exception(...) trapped.");
305  }
306 
307  tp->Status (KKThread::ThreadStatus::Stopped);
308  return 0;
309  }
ThreadStatus Status() const
Definition: KKThread.h:72
bool Crashed() const
Definition: KKThread.h:62
The base class to be used any thread.
Definition: KKThread.h:27
const KKStr & ExceptionText() const
Definition: KKThread.h:66
KKThread::KKThreadPtr KKThreadPtr
Definition: KKThread.h:209
virtual const KKStr & ToString() const
Definition: KKException.cpp:98
virtual void Run()
Definition: KKThread.cpp:447