RIOT icon indicating copy to clipboard operation
RIOT copied to clipboard

suit: start worker thread on demand, make suit_handle_url() public

Open benpicco opened this issue 3 years ago • 3 comments

Contribution description

Drop the need to call suit_worker_run() before calling suit_worker_trigger() - the thread only has a single purpose anyway.

Also make the suit_handle_url() function available to users who already have a sufficiently large stack, when no worker thread should be started at all.

Testing procedure

Issues/PRs references

benpicco avatar Sep 04 '22 14:09 benpicco

How about using an event thread instead, which could also be reused for other stuff?

maribu avatar Sep 05 '22 05:09 maribu

My only concern there is that events are usually short tasks - if we'd use the event thread for installing the update, that would block other events for a long time.

I'm not sure if anything on the system level relies on the event thread though, so this would then only block user applications which is probably fine.

The main idea behind this is that we now export suit_handle_url(), so if the user already has a thread with a sufficient stack size, they can just use that and skip the dedicated worker thread.

benpicco avatar Sep 19 '22 18:09 benpicco

I'm not sure if anything on the system level relies on the event thread though, so this would then only block user applications which is probably fine.

Hm, that's one thing I like about the extra thread, that updating doesn't stop the application.

kaspar030 avatar Sep 19 '22 19:09 kaspar030

Well with this the user can just call suit_handle_url() from the event thread if they so desire - with #18656 just a single event_callback_oneshot() is needed.

So I think we don't have to mandate the event thread for this.

benpicco avatar Sep 28 '22 16:09 benpicco

@maribu thank you!

benpicco avatar Nov 30 '22 10:11 benpicco