ipkn / crow

Crow is very fast and easy to use C++ micro web framework (inspired by Python Flask)
BSD 3-Clause "New" or "Revised" License
7.47k stars 889 forks source link

Scheduled tasks? #97

Open trevstanhope opened 8 years ago

trevstanhope commented 8 years ago

Does crow have the ability to schedule tasks to be run on an interval? I.e. like for scheduling a maintenance function? (similar to Monitors in CherryPy3)

Would you be interested in help building/integrating that feature?

voldyman commented 8 years ago

:+1: interested in this feature.

acron0 commented 8 years ago

I don't really agree that this feature is in the spirit of a Flask-inspired web framework. There are a lot of examples here on GitHub of C++ schedulers that you can integrate with ease.

ipkn commented 8 years ago

I think "run in the same thread" feature can be helpful for avoiding some multithreading problems. (like app.post(req, Work)) But if you need more sophiscated features, using a library for it is probably better.

trevstanhope commented 8 years ago

@acron0 / @ipkn, are you aware of another C++ project which is intended for scheduled execution of threaded tasks that might be a good fit for me to patch into a fork of crow?

acron0 commented 8 years ago

@trevstanhope For threaded (or not) tasks I've used C++CSP2 but not sure about scheduling (don't do much C++ these days).

Sqeaky commented 8 years ago

Depending on how complex your tasks are you might be able to get away an std::thread or an std::packaged_task combined with std::this_thread::sleep_until.