Project

General

Profile

Actions

Feature #5649

open

Add an API to WIOService to cancel scheduled tasks

Added by Kayra Akman almost 7 years ago. Updated almost 7 years ago.

Status:
New
Priority:
Normal
Assignee:
Roel Standaert
Target version:
-
Start date:
04/10/2017
Due date:
% Done:

0%

Estimated time:

Description

As mentioned in #5648, WIOService::stop() blocks until all tasks, running or scheduled to run, are executed. Since there is no API to cancel scheduled tasks, WServer::stop() may get blocked due to scheduled tasks. If a scheduled task is to be run after a long period of time, the application becomes useless since the server is stopped before the IO service is stopped in WServer::stop().

IMO, an API such as WIOService::cancelScheduledTasks() should be added to WIOService and called in WServer::stop() before stopping the IO service.

Actions #1

Updated by Wim Dumon almost 7 years ago

  • Assignee set to Roel Standaert

Hey Kayra,

That would probably be a useful addition.

We noted however that deadline_timers are not thread safe, so canceling them will need to be done with proper care in Wt's multithreaded architecture.

This splits the problem in two parts:

  • create timers so that they can be canceled (proper use of strands seem to allow for this); in that respect it's probably a good idea to have the schedule call return an object that allows cancelation
  • keep track of all active timers, so that cancelScheduledTasks() can be implemented

Wim.

Actions

Also available in: Atom PDF