Fix #13449: add 'blocking' parameter to sched.scheduler.run() so that the scheduler can be used in non-blocking applications
diff --git a/Doc/library/sched.rst b/Doc/library/sched.rst
index 455cc70..957bdd3 100644
--- a/Doc/library/sched.rst
+++ b/Doc/library/sched.rst
@@ -102,12 +102,15 @@
    Return true if the event queue is empty.
 
 
-.. method:: scheduler.run()
+.. method:: scheduler.run(blocking=True)
 
-   Run all scheduled events. This function will wait  (using the :func:`delayfunc`
+   Run all scheduled events. This method will wait  (using the :func:`delayfunc`
    function passed to the constructor) for the next event, then execute it and so
    on until there are no more scheduled events.
 
+   If *blocking* is False executes the scheduled events due to expire soonest
+   (if any) and then return.
+
    Either *action* or *delayfunc* can raise an exception.  In either case, the
    scheduler will maintain a consistent state and propagate the exception.  If an
    exception is raised by *action*, the event will not be attempted in future calls
@@ -118,6 +121,9 @@
    the calling code is responsible for canceling  events which are no longer
    pertinent.
 
+   .. versionadded:: 3.3
+      *blocking* parameter was added.
+
 .. attribute:: scheduler.queue
 
    Read-only attribute returning a list of upcoming events in the order they
diff --git a/Doc/whatsnew/3.3.rst b/Doc/whatsnew/3.3.rst
index 91d3f90..c52eaf1 100644
--- a/Doc/whatsnew/3.3.rst
+++ b/Doc/whatsnew/3.3.rst
@@ -662,6 +662,12 @@
 sched
 -----
 
+* :meth:`~sched.scheduler.run` now accepts a *blocking* parameter which when
+  set to False makes the method execute the scheduled events due to expire
+  soonest (if any) and then return immediately.
+  This is useful in case you want to use the :class:`~sched.scheduler` in
+  non-blocking applications.  (Contributed by Giampaolo Rodolà in :issue:`13449`)
+
 * :class:`~sched.scheduler` class can now be safely used in multi-threaded
   environments.  (Contributed by Josiah Carlson and Giampaolo Rodolà in
   :issue:`8684`)