pw_thread: adds the initial pw_thread module

Adds a std::this_thread like API through the pw_thread facades, that
is:
1) this_thread::yield
2) this_thread::sleep_{for,until}
3) this_thread::get_id

This module is split into many different facades in order to let users
decide what functionality they want to use as they may not always
be available, for example when using opaque SDKs.

In addition this provides an initial set of backends based on using
the STL's std::this_thread directly and selects them for the host
target.

Change-Id: I0ee8e4390ba988b2b13e9ee59f976f2333715f1f
Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/30040
Commit-Queue: Ewout van Bekkum <ewout@google.com>
Reviewed-by: Keir Mierle <keir@google.com>
Reviewed-by: Wyatt Hepler <hepler@google.com>
diff --git a/pw_thread/sleep.cc b/pw_thread/sleep.cc
new file mode 100644
index 0000000..28313fd
--- /dev/null
+++ b/pw_thread/sleep.cc
@@ -0,0 +1,28 @@
+// Copyright 2020 The Pigweed Authors
+//
+// Licensed under the Apache License, Version 2.0 (the "License"); you may not
+// use this file except in compliance with the License. You may obtain a copy of
+// the License at
+//
+//     https://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+// WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+// License for the specific language governing permissions and limitations under
+// the License.
+
+#include "pw_thread/sleep.h"
+
+using pw::chrono::SystemClock;
+
+extern "C" void pw_this_thread_SleepFor(
+    pw_chrono_SystemClock_TickCount for_at_least) {
+  pw::this_thread::sleep_for(SystemClock::duration(for_at_least));
+}
+
+extern "C" void pw_this_thread_SleepUntil(
+    pw_chrono_SystemClock_TimePoint until_at_least) {
+  pw::this_thread::sleep_until(SystemClock::time_point(
+      SystemClock::duration(until_at_least.ticks_since_epoch)));
+}