ryanmcgrath / cacao

Rust bindings for AppKit (macOS) and UIKit (iOS/tvOS). Experimental, but working!
MIT License
1.79k stars 65 forks source link

Async, Background, and Local Dispatchers support #81

Open JoshuaBrest opened 1 year ago

JoshuaBrest commented 1 year ago

I think we should add the following features to make development easier:

madsmtm commented 1 year ago

See some of the previous discussion on this in https://github.com/madsmtm/objc2/issues/279.

In short: async Objective-C is difficult, and especially difficult to make efficient!

ryanmcgrath commented 1 year ago

I'm neither for nor against this conceptually, but I think I'd ultimately defer to anything @madsmtm does upstream in objc2 - which cacao needs to ultimately rebase on and finally merge anyway.

We can keep this open as a general tracking issue and I'll label it accordingly, but don't expect much for some time.

JoshuaBrest commented 11 months ago

For the local dispatcher, i think it would be possible if we added lifetimes or just used unsafe. It should be fine if we unregister the fn,

JoshuaBrest commented 11 months ago

@ryanmcgrath As I was discovering about objc it turns out the handlers are called in a different whole context where memory in the main thread is not even accessible from a rust fn.