nikomatsakis / context-capabilities-initiative

https://nikomatsakis.github.io/context-capabilities-initiative/
Apache License 2.0
12 stars 1 forks source link

UI thread contexts #7

Closed yoshuawuyts closed 2 years ago

yoshuawuyts commented 2 years ago

One use case which surfaced today was being able to track whether we're on the "main UI thread" or some other thread. I'm wondering if we could model this with a context capability which is unsafe to create, and !send + !Sync.

This kind of feels like it would be inherent to the thread which we create, almost like an auto-context? But since we probably can't build it in, having it be a regular context could work just as well.

This feels like a common pattern which occurs (browsers, dotnet, all work like this), so it might be worth writing out as a use case.

yoshuawuyts commented 2 years ago

Migrating this issue to #8