-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Re-factor of how threading and event dispatch is handled in the SDK #7725
Comments
Haven't gotten far enough into it; however, as noted in the #6561 review, I am working towards porting these CoreFoundation / CFNetwork libraries and iOS apps to CHIP: In theory, I should need only the singular main CFRunLoop with no further threading to make these/this work. As noted in #6561, I should be able to import the InetLayer sockets into CFSocketStreams, schedule them onto the run loop, and go. |
That should definitely be possible with the model being suggested here. |
Followups from project-chip#6561 Generalize socket-based event loop #### Change overview * mDNS: Convert `platform/Linux/MdnsImpl`; remove Darwin stubs. * Change `mCallbackData` type to `intptr_t` (review feedback). * Comment for `System::WakeEvent` (this is minimal since it's likely to change soon for issue project-chip#7725). Fixes project-chip#7758 _Convert MDNS to WatchableSocket._ #### Testing Manual sanity check of mDNS using chip-device-ctrl on Linux. Otherwise, no change to functionality is intended.
Tagging #7818 for inspection |
Tagging #7803 |
Followups from project-chip#6561 Generalize socket-based event loop #### Change overview * mDNS: Convert `platform/Linux/MdnsImpl`; remove Darwin stubs. * Change `mCallbackData` type to `intptr_t` (review feedback). * Comment for `System::WakeEvent` (this is minimal since it's likely to change soon for issue project-chip#7725). Fixes project-chip#7758 _Convert MDNS to WatchableSocket._ #### Testing Manual sanity check of mDNS using chip-device-ctrl on Linux. Otherwise, no change to functionality is intended.
Followups from project-chip#6561 Generalize socket-based event loop #### Change overview * mDNS: Convert `platform/Linux/MdnsImpl`; remove Darwin stubs. * Change `mCallbackData` type to `intptr_t` (review feedback). * Comment for `System::WakeEvent` (this is minimal since it's likely to change soon for issue project-chip#7725). Fixes project-chip#7758 _Convert MDNS to WatchableSocket._ #### Testing Manual sanity check of mDNS using chip-device-ctrl on Linux. Otherwise, no change to functionality is intended.
* #### Problem Followups from #6561 Generalize socket-based event loop #### Change overview * mDNS: Convert `platform/Linux/MdnsImpl`; remove Darwin stubs. * Change `mCallbackData` type to `intptr_t` (review feedback). * Comment for `System::WakeEvent` (this is minimal since it's likely to change soon for issue #7725). Fixes #7758 _Convert MDNS to WatchableSocket._ #### Testing Manual sanity check of mDNS using chip-device-ctrl on Linux. Otherwise, no change to functionality is intended. * review * review
#### Problem System Layer contains some unnecessary coupling, and a number of ambiguous names, involving clock and time. (This is a standalone fragment of work toward event/threading refactoring, issue project-chip#7725) #### Change overview SystemLayer / SystemClock - Add distinct type names MonotonicMilliseconds, MonotonicMicroseconds, UnixTimeMicroseconds. - Move System::Layer clock functions to their own class. - Rename them to make the time units explicit. - Use them in preference to the System::Platform::Layer versions. - Remove the HiRes version, which has no separate implementation. - Move the platform implementations from System::Platform::Layer (not to be confused with System::Layer) to System::Platform::Clock. - Removed the statement that SetUnixTimeMicroseconds() must be thread-safe. Since this function is not currently used, this imposes no burden on existing code. TimeUtils - Rename functions to make clean when ‘Epoch’ means the UNIX epoch. - Use the scale conversion constants more often. SystemTimer - Remove the Timer::Epoch typedef, which wasn't an epoch, and rename SetTimerEpoch() to SetTimestamp(). - Remove the deprecated System::Timer::GetCurrentEpoch(). #### Testing This change largely just renames existing code, so no functional changes are expected. Existing cases in TestPlatformTime.cpp should catch any mistakes in unit substititutions or conversions contstants.
#### Problem `System::Layer` has redundancy in event configuration, and a confusingly-named grab-bag namespace `System::Platform::Layer` This is a standalone fragment of work toward event/threading refactoring, issue project-chip#7725. #### Change overview - Merge `CHIP_SYSTEM_CONFIG_LWIP_EVENT_OBJECT_TYPE` with `CHIP_SYSTEM_CONFIG_EVENT_OBJECT_TYPE`, and `CHIP_SYSTEM_CONFIG_LWIP_EVENT_TYPE` with `CHIP_SYSTEM_CONFIG_EVENT_TYPE`, since they serve the same purpose in LwIP and non-LwIP implementations respectively. - Remove some dead configuration code. - Move event functions from the `System::Platform::Layer` namespace (not the same kind of ‘layer’ as `System::Layer`) to a specific `System::Platform::EventSupport` namespace. - Move (Will|Did)(Init|Shutdown) functions from the `System::Platform::Layer` namespace up to `System::Platform`. #### Testing No functional changes, only renaming and pruning.
#### Problem System Layer contains some unnecessary coupling, and a number of ambiguous names, involving clock and time. (This is a standalone fragment of work toward event/threading refactoring, issue project-chip#7725) #### Change overview SystemLayer / SystemClock - Add distinct type names MonotonicMilliseconds, MonotonicMicroseconds, UnixTimeMicroseconds. - Move System::Layer clock functions to their own class. - Rename them to make the time units explicit. - Use them in preference to the System::Platform::Layer versions. - Remove the HiRes version, which has no separate implementation. - Move the platform implementations from System::Platform::Layer (not to be confused with System::Layer) to System::Platform::Clock. - Removed the statement that SetUnixTimeMicroseconds() must be thread-safe. Since this function is not currently used, this imposes no burden on existing code. TimeUtils - Rename functions to make clean when ‘Epoch’ means the UNIX epoch. - Use the scale conversion constants more often. SystemTimer - Remove the Timer::Epoch typedef, which wasn't an epoch, and rename SetTimerEpoch() to SetTimestamp(). - Remove the deprecated System::Timer::GetCurrentEpoch(). #### Testing This change largely just renames existing code, so no functional changes are expected. Existing cases in TestPlatformTime.cpp should catch any mistakes in unit substititutions or conversions contstants.
* Revise System Layer clock code #### Problem System Layer contains some unnecessary coupling, and a number of ambiguous names, involving clock and time. (This is a standalone fragment of work toward event/threading refactoring, issue #7725) #### Change overview SystemLayer / SystemClock - Add distinct type names MonotonicMilliseconds, MonotonicMicroseconds, UnixTimeMicroseconds. - Move System::Layer clock functions to their own class. - Rename them to make the time units explicit. - Use them in preference to the System::Platform::Layer versions. - Remove the HiRes version, which has no separate implementation. - Move the platform implementations from System::Platform::Layer (not to be confused with System::Layer) to System::Platform::Clock. - Removed the statement that SetUnixTimeMicroseconds() must be thread-safe. Since this function is not currently used, this imposes no burden on existing code. TimeUtils - Rename functions to make clean when ‘Epoch’ means the UNIX epoch. - Use the scale conversion constants more often. SystemTimer - Remove the Timer::Epoch typedef, which wasn't an epoch, and rename SetTimerEpoch() to SetTimestamp(). - Remove the deprecated System::Timer::GetCurrentEpoch(). #### Testing This change largely just renames existing code, so no functional changes are expected. Existing cases in TestPlatformTime.cpp should catch any mistakes in unit substititutions or conversions contstants. * fix esp32 lock-app build, and name kMillisecondsPerSecond
* Revisions to System::Layer #### Problem `System::Layer` has redundancy in event configuration, and a confusingly-named grab-bag namespace `System::Platform::Layer` This is a standalone fragment of work toward event/threading refactoring, issue #7725. #### Change overview - Merge `CHIP_SYSTEM_CONFIG_LWIP_EVENT_OBJECT_TYPE` with `CHIP_SYSTEM_CONFIG_EVENT_OBJECT_TYPE`, and `CHIP_SYSTEM_CONFIG_LWIP_EVENT_TYPE` with `CHIP_SYSTEM_CONFIG_EVENT_TYPE`, since they serve the same purpose in LwIP and non-LwIP implementations respectively. - Remove some dead configuration code. - Move event functions from the `System::Platform::Layer` namespace (not the same kind of ‘layer’ as `System::Layer`) to a specific `System::Platform::EventSupport` namespace. - Move (Will|Did)(Init|Shutdown) functions from the `System::Platform::Layer` namespace up to `System::Platform`. #### Testing No functional changes, only renaming and pruning. * restyle * zap regen
…roject-chip#7799) * #### Problem Followups from project-chip#6561 Generalize socket-based event loop #### Change overview * mDNS: Convert `platform/Linux/MdnsImpl`; remove Darwin stubs. * Change `mCallbackData` type to `intptr_t` (review feedback). * Comment for `System::WakeEvent` (this is minimal since it's likely to change soon for issue project-chip#7725). Fixes project-chip#7758 _Convert MDNS to WatchableSocket._ #### Testing Manual sanity check of mDNS using chip-device-ctrl on Linux. Otherwise, no change to functionality is intended. * review * review
* Revise System Layer clock code #### Problem System Layer contains some unnecessary coupling, and a number of ambiguous names, involving clock and time. (This is a standalone fragment of work toward event/threading refactoring, issue project-chip#7725) #### Change overview SystemLayer / SystemClock - Add distinct type names MonotonicMilliseconds, MonotonicMicroseconds, UnixTimeMicroseconds. - Move System::Layer clock functions to their own class. - Rename them to make the time units explicit. - Use them in preference to the System::Platform::Layer versions. - Remove the HiRes version, which has no separate implementation. - Move the platform implementations from System::Platform::Layer (not to be confused with System::Layer) to System::Platform::Clock. - Removed the statement that SetUnixTimeMicroseconds() must be thread-safe. Since this function is not currently used, this imposes no burden on existing code. TimeUtils - Rename functions to make clean when ‘Epoch’ means the UNIX epoch. - Use the scale conversion constants more often. SystemTimer - Remove the Timer::Epoch typedef, which wasn't an epoch, and rename SetTimerEpoch() to SetTimestamp(). - Remove the deprecated System::Timer::GetCurrentEpoch(). #### Testing This change largely just renames existing code, so no functional changes are expected. Existing cases in TestPlatformTime.cpp should catch any mistakes in unit substititutions or conversions contstants. * fix esp32 lock-app build, and name kMillisecondsPerSecond
* Revisions to System::Layer #### Problem `System::Layer` has redundancy in event configuration, and a confusingly-named grab-bag namespace `System::Platform::Layer` This is a standalone fragment of work toward event/threading refactoring, issue project-chip#7725. #### Change overview - Merge `CHIP_SYSTEM_CONFIG_LWIP_EVENT_OBJECT_TYPE` with `CHIP_SYSTEM_CONFIG_EVENT_OBJECT_TYPE`, and `CHIP_SYSTEM_CONFIG_LWIP_EVENT_TYPE` with `CHIP_SYSTEM_CONFIG_EVENT_TYPE`, since they serve the same purpose in LwIP and non-LwIP implementations respectively. - Remove some dead configuration code. - Move event functions from the `System::Platform::Layer` namespace (not the same kind of ‘layer’ as `System::Layer`) to a specific `System::Platform::EventSupport` namespace. - Move (Will|Did)(Init|Shutdown) functions from the `System::Platform::Layer` namespace up to `System::Platform`. #### Testing No functional changes, only renaming and pruning. * restyle * zap regen
#### Problem `AsyncDNSResolver` is unused, and also uses threading internally, which interferes with threading cleanup (issue project-chip#7725). #### Change overview Remove it. #### Testing CI. (This code had no unit tests.)
#### Problem `AsyncDNSResolver` is unused, and also uses threading internally, which interferes with threading cleanup (issue #7725). #### Change overview Remove it. #### Testing CI. (This code had no unit tests.)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
This stale issue has been automatically closed. Thank you for your contributions. |
Problem
DeviceController::Init
callsStartEventLoopTask
, which always spins up a thread on POSIX platforms.Solution
chip-tool
as a way to showcase the different possible threading strategies an application can use, serving as a reference of sorts for developers to see how they can construct their own. The strategies include (but are not limited to):Tactical
The text was updated successfully, but these errors were encountered: