Skip to content

Proposal: option to lock child goroutines to same OS thread #23758

@shelby3

Description

@shelby3

I responded in a comment to a Stackoverflow question Does runtime.LockOSThread allow child goroutines to run in same OS thread? about unavailability of this feature:

Even though it’s not currently supported, it has been proposed for a new optional capability. And I have proposed other use cases.

I became motivated to propose this here when I realized a very important style of programming that can’t be done without adding this capability.

I searched for other issue threads and the somewhat related ones found:

#4056
#21827
#12462

Seems perhaps the last one #12462 could be addressed with this proposal?

How does the community feel about this proposal? Would it likely be accepted into the mainline if someone did the work?

EDIT: please read my follow-up post, wherein I explain this really isn’t about supporting FRP, yet more fundamentally about optimal event handling (in any programming paradigm) in the UI thread and lockless concurrency design. I don’t wish for readers to misinterpret this proposal as an attempt to turn Go into Haskell (I know Go’s target audience would be turned off by that). That’s not the point.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions