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

How was this tested? (at least one bullet point required)
* If unit tests were added, how do they cover this issue?
* If unit tests existed, how were they fixed/modified to prevent this in future?
* If new unit tests are not added, why not?
* If integration tests were added, how do they verify this change?
* If new integration tests are not added, why not?
* If manually tested, what platforms controller and device platforms were manually tested, and how?
* If no testing is required, why not?
  • Loading branch information
kpschoedel committed Aug 5, 2021
1 parent b9c8a85 commit dd9637a
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 dd9637a

Please sign in to comment.