Skip to content

Commit

Permalink
#### Problem
Browse files Browse the repository at this point in the history
The event loop in JNI `IOThreadMain()` used to wait no more than ten
seconds on each iteration. This timeout was temporarily removed in
PR project-chip#6561.

#### Change overview

Add an explicit ten second timer.

Fixes project-chip#7756 _add a timer for sleepTime.tv_sec = 10; sleepTime.tv_usec = 0;_

#### Testing

Passes Android workflow.
  • Loading branch information
kpschoedel committed Aug 5, 2021
1 parent b9c8a85 commit 5c2d9a2
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/controller/java/CHIPDeviceController-JNI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1066,7 +1066,10 @@ void * IOThreadMain(void * arg)
// Loop until we are told to exit.
while (!quit.load(std::memory_order_relaxed))
{
// TODO(#5556): add a timer for `sleepTime.tv_sec = 10; sleepTime.tv_usec = 0;`
// Wait no more than 10 seconds.
constexpr uint32_t k10secondsInMilliseconds = 10000;
sSystemLayer.StartTimer(k10secondsInMilliseconds, [](System::Layer *, void *, CHIP_ERROR) -> void {}, nullptr);

watchState.PrepareEvents();

// Unlock the stack so that Java threads can make API calls.
Expand Down

0 comments on commit 5c2d9a2

Please sign in to comment.