News for hackers. Stuff that matters.
Re:Introduction to Golang Preemption Mechanisms by ollien on Sunday August 11, 2024 @05:29PM (#41219447)
Great post! One question that lingered for me is: what are asynchronous safe-points? The post goes into some detail about their synchronous counterparts
Re:Introduction to Golang Preemption Mechanisms by MathMonkeyMan on Monday August 12, 2024 @05:09AM (#41222570)
I don't know, but I remember hearing in a talk that the compiler had to be modified to insert them into the generated code.

Here's `isAsyncSafePoint`: https://github.com/golang/go/blob/d36353499f673c89a267a489be...

edit: The comments at the top of that file say:

    // 3. Asynchronous safe-points occur at any instruction in user code
    //    where the goroutine can be safely paused and a conservative
    //    stack and register scan can find stack roots. The runtime can
    //    stop a goroutine at an async safe-point using a signal.