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

Method Add

src/hx/Debugger.cpp:375–405  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

373 }
374
375 static int Add(String inFileName, int lineNumber)
376 {
377 // Look up the filename constant
378 const char *fileName = LookupFileName(inFileName);
379
380 if (!fileName) {
381 return -1;
382 }
383
384 gMutex.lock();
385
386 int ret = gNextBreakpointNumber++;
387
388 Breakpoints *newBreakpoints = new Breakpoints(gBreakpoints, ret, fileName, lineNumber);
389
390 gBreakpoints->RemoveRef();
391
392 // Write memory barrier ensures that newBreakpoints values are updated
393 // before gBreakpoints is assigned to it
394 write_memory_barrier();
395
396 gBreakpoints = newBreakpoints;
397
398 // Don't need a write memory barrier here, it's harmless to see
399 // gShouldCallHandleBreakpoints update before gBreakpoints has updated
400 gShouldCallHandleBreakpoints = true;
401
402 gMutex.unlock();
403
404 return ret;
405 }
406
407 void RemoveRef()
408 {

Callers

nothing calls this directly

Calls 2

write_memory_barrierFunction · 0.85
RemoveRefMethod · 0.80

Tested by

no test coverage detected