IssueRaiser

Make Windows plugin APIs thread-safe

Currently many core plugin APIs in Windows are platform-thread only, as on other platforms. However, as discussed in https://github.com/flutter/engine/pull/31134#pullrequestreview-991213668 and https://github.com/flutter/flutter/issues/79213 this doesn't work well on Windows, both in terms of OS APIs to facilitate it (there aren't any, unlike other platforms), and convention (Win32 APIs generally don't care what thread you are on). To better match platform conventions, we should make APIs like sending channel messages internally thread safe (by having the embedding internally post them to the platform thread, which we already have a mechanism for). This may well be straightforward for the C API, but we'll need to make the C++ wrapper that almost all code actually uses that safe as well, which may require some locking. (We would only do one of https://github.com/flutter/flutter/issues/79213 and this.)

Posted by stuartmorgan-g on Sep 9, 2023, 12:30 PM

Tags

Related issues

Raise real-world problems, find people facing the same issue, and discuss solutions.2,000 issues0 comments

github (Software)

Make Windows plugin APIs thread-safe

stuartmorgan-gSep 9, 2023, 12:30 PM

Currently many core plugin APIs in Windows are platform-thread only, as on other platforms. However, as discussed in https://github.com/flutter/engine/pull/31134#pullrequestreview-991213668 and https://github.com/flutter/flutter/issues/79213 this doesn't work well on Windows, both in terms of OS APIs to facilitate it (there aren't any, unlike other platforms), and convention (Win32 APIs generally don't care what thread you are on). To better match platform conventions, we should make APIs like sending channel messages internally thread safe (by having the embedding internally post them to the platform thread, which we already have a mechanism for). This may well be straightforward for the C API, but we'll need to make the C++ wrapper that almost all code actually uses that safe as well, which may require some locking. (We would only do one of https://github.com/flutter/flutter/issues/79213 and this.)

Comments (0)

No comments yet. Start the discussion.

Comment on this issue