MCPcopy Create free account
hub / github.com/HaxeFoundation/hxcpp / attach

Method attach

src/hx/Debugger.cpp:128–151  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

126 }
127
128 void attach(StackContext *inStack)
129 {
130 mAttached = true;
131 mStackContext = inStack;
132 mThreadNumber = mStackContext->mThreadId;
133 mStatus = DBG_STATUS_RUNNING;
134 gMutex.lock();
135 gList.push_back(this);
136 gMap[mThreadNumber] = this;
137 gMutex.unlock();
138
139 // Note that there is a race condition here. If the debugger is
140 // "detaching" at this exact moment, it might set the event handler to
141 // NULL during this call. So latch the handler variable. This means that
142 // the handler might be called even after the debugger thread has set it
143 // to NULL, but this should generally be harmless. Doing this correctly
144 // would require some sophisticated locking that just doesn't seem worth
145 // it, when the worst that can happen is an extra call to the handler
146 // function milliseconds after it's set to NULL ...
147
148 Dynamic handler = hx::g_eventNotificationHandler;
149 if (handler != null())
150 handler(mThreadNumber, hx::THREAD_CREATED);
151 }
152
153 void detach()
154 {

Callers 1

dbgCtxAttachFunction · 0.45

Calls 1

nullClass · 0.50

Tested by

no test coverage detected