Add a debug-only guard to check if code is running on the task runner

Change-Id: I10953bf5bb0c7f823c15d3bf3640a03a9c2ff43d
Reviewed-on: https://chromium-review.googlesource.com/c/openscreen/+/1815070
Commit-Queue: Max Yakimakha <yakimakha@chromium.org>
Reviewed-by: Jordan Bayles <jophba@chromium.org>
diff --git a/platform/impl/task_runner.h b/platform/impl/task_runner.h
index f80641d..569b747 100644
--- a/platform/impl/task_runner.h
+++ b/platform/impl/task_runner.h
@@ -10,6 +10,7 @@
 #include <map>
 #include <memory>
 #include <mutex>  // NOLINT
+#include <thread>
 #include <utility>
 #include <vector>
 
@@ -56,6 +57,7 @@
   ~TaskRunnerImpl() final;
   void PostPackagedTask(Task task) final;
   void PostPackagedTaskWithDelay(Task task, Clock::duration delay) final;
+  bool IsRunningOnTaskRunner() final;
 
   // Tasks will only be executed if RunUntilStopped has been called, and
   // RequestStopSoon has not. Important note: TaskRunner does NOT do any
@@ -150,6 +152,8 @@
   // empty, and is swapped with |tasks_| when it is time to run the Tasks.
   std::vector<TaskWithMetadata> running_tasks_;
 
+  std::thread::id task_runner_thread_id_;
+
   OSP_DISALLOW_COPY_AND_ASSIGN(TaskRunnerImpl);
 };
 }  // namespace platform