def _new(thread_handle, arg): # No shadowstack manipulation here (no usage of gc references) sscopy = sscopy_detach_shadow_stack() gcrootfinder.sscopy = sscopy if not sscopy: return _c.null_handle h = _c.new(thread_handle, llhelper(_c.run_fn, _new_callback), arg) sscopy_attach_shadow_stack(sscopy) return h
def _new_callback(): # Here, we just closed the stack. Get the stack anchor, store # it in the gcrootfinder.suspstack.anchor, and create a new # stacklet with stacklet_new(). If this call fails, then we # are just returning NULL. _stack_just_closed() # return _c.new(gcrootfinder.newthrd, llhelper(_c.run_fn, _new_runfn), llmemory.NULL)
def new(thrd, callback, arg): h = _c.new(thrd._thrd, llhelper(_c.run_fn, callback), arg) if not h: raise MemoryError return h
def new(thrd, callback, arg): gcrootfinder.callback = callback thread_handle = thrd._thrd prepare_old_suspstack() h = _c.new(thread_handle, llhelper(_c.run_fn, _new_callback), arg) return get_result_suspstack(h)