Merge "add linux wayland platform"
diff --git a/src/starboard/contrib/linux/x64wl/atomic_public.h b/src/starboard/contrib/linux/x64wl/atomic_public.h
new file mode 100644
index 0000000..63bcc6a
--- /dev/null
+++ b/src/starboard/contrib/linux/x64wl/atomic_public.h
@@ -0,0 +1,20 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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
+//
+//     http://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.
+
+#ifndef STARBOARD_CONTRIB_LINUX_X64WL_ATOMIC_PUBLIC_H_
+#define STARBOARD_CONTRIB_LINUX_X64WL_ATOMIC_PUBLIC_H_
+
+#include "starboard/linux/shared/atomic_public.h"
+
+#endif  // STARBOARD_CONTRIB_LINUX_X64WL_ATOMIC_PUBLIC_H_
diff --git a/src/starboard/contrib/linux/x64wl/configuration_public.h b/src/starboard/contrib/linux/x64wl/configuration_public.h
new file mode 100644
index 0000000..9628a6e
--- /dev/null
+++ b/src/starboard/contrib/linux/x64wl/configuration_public.h
@@ -0,0 +1,127 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// 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
+//
+//     http://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.
+
+// The Starboard configuration for Desktop X86 Linux. Other devices will have
+// specific Starboard implementations, even if they ultimately are running some
+// version of Linux.
+
+// Other source files should never include this header directly, but should
+// include the generic "starboard/configuration.h" instead.
+
+#ifndef STARBOARD_CONTRIB_LINUX_X64WL_CONFIGURATION_PUBLIC_H_
+#define STARBOARD_CONTRIB_LINUX_X64WL_CONFIGURATION_PUBLIC_H_
+
+// --- Architecture Configuration --------------------------------------------
+
+// Whether the current platform is big endian. SB_IS_LITTLE_ENDIAN will be
+// automatically set based on this.
+#define SB_IS_BIG_ENDIAN 0
+
+// Whether the current platform is an ARM architecture.
+#define SB_IS_ARCH_ARM 0
+
+// Whether the current platform is a MIPS architecture.
+#define SB_IS_ARCH_MIPS 0
+
+// Whether the current platform is a PPC architecture.
+#define SB_IS_ARCH_PPC 0
+
+// Whether the current platform is an x86 architecture.
+#define SB_IS_ARCH_X86 1
+
+// Whether the current platform is a 32-bit architecture.
+#if defined(__i386__)
+#define SB_IS_32_BIT 1
+#else
+#define SB_IS_32_BIT 0
+#endif
+
+// Whether the current platform is a 64-bit architecture.
+#if defined(__x86_64__)
+#define SB_IS_64_BIT 1
+#else
+#define SB_IS_64_BIT 0
+#endif
+
+// Whether the current platform's pointers are 32-bit.
+// Whether the current platform's longs are 32-bit.
+#if SB_IS(32_BIT)
+#define SB_HAS_32_BIT_POINTERS 1
+#define SB_HAS_32_BIT_LONG 1
+#else
+#define SB_HAS_32_BIT_POINTERS 0
+#define SB_HAS_32_BIT_LONG 0
+#endif
+
+// Whether the current platform's pointers are 64-bit.
+// Whether the current platform's longs are 64-bit.
+#if SB_IS(64_BIT)
+#define SB_HAS_64_BIT_POINTERS 1
+#define SB_HAS_64_BIT_LONG 1
+#else
+#define SB_HAS_64_BIT_POINTERS 0
+#define SB_HAS_64_BIT_LONG 0
+#endif
+
+// Configuration parameters that allow the application to make some general
+// compile-time decisions with respect to the the number of cores likely to be
+// available on this platform. For a definitive measure, the application should
+// still call SbSystemGetNumberOfProcessors at runtime.
+
+// Whether the current platform is expected to have many cores (> 6), or a
+// wildly varying number of cores.
+#define SB_HAS_MANY_CORES 1
+
+// Whether the current platform is expected to have exactly 1 core.
+#define SB_HAS_1_CORE 0
+
+// Whether the current platform is expected to have exactly 2 cores.
+#define SB_HAS_2_CORES 0
+
+// Whether the current platform is expected to have exactly 4 cores.
+#define SB_HAS_4_CORES 0
+
+// Whether the current platform is expected to have exactly 6 cores.
+#define SB_HAS_6_CORES 0
+
+// Whether the current platform's thread scheduler will automatically balance
+// threads between cores, as opposed to systems where threads will only ever run
+// on the specifically pinned core.
+#define SB_HAS_CROSS_CORE_SCHEDULER 1
+
+// --- Graphics Configuration ------------------------------------------------
+
+// Indicates whether or not the given platform supports rendering of NV12
+// textures. These textures typically originate from video decoders.
+#define SB_HAS_NV12_TEXTURE_SUPPORT 1
+
+// Whether the current platform has speech synthesis.
+#define SB_HAS_SPEECH_SYNTHESIS 0
+
+// Include the Linux configuration that's common between all Desktop Linuxes.
+#include "starboard/linux/shared/configuration_public.h"
+
+// The current platform has microphone supported.
+#undef SB_HAS_MICROPHONE
+#define SB_HAS_MICROPHONE 1
+
+#if SB_API_VERSION >= 8
+// Whether the current platform implements the on screen keyboard interface.
+#define SB_HAS_ON_SCREEN_KEYBOARD 0
+
+// Whether the current platform uses a media player that relies on a URL.
+#define SB_HAS_PLAYER_WITH_URL 0
+#endif  // SB_API_VERSION >= 8
+
+#endif  // STARBOARD_CONTRIB_LINUX_X64WL_CONFIGURATION_PUBLIC_H_
diff --git a/src/starboard/contrib/linux/x64wl/gyp_configuration.gypi b/src/starboard/contrib/linux/x64wl/gyp_configuration.gypi
new file mode 100644
index 0000000..0683968
--- /dev/null
+++ b/src/starboard/contrib/linux/x64wl/gyp_configuration.gypi
@@ -0,0 +1,52 @@
+# Copyright 2017 Google Inc. All Rights Reserved.
+#
+# 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
+#
+#     http://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.
+
+{
+  'target_defaults': {
+    'default_configuration': 'linux-x64wl_debug',
+    'configurations': {
+      'linux-x64wl_debug': {
+        'inherit_from': ['debug_base'],
+      },
+      'linux-x64wl_devel': {
+        'inherit_from': ['devel_base'],
+      },
+      'linux-x64wl_qa': {
+        'inherit_from': ['qa_base'],
+      },
+      'linux-x64wl_gold': {
+        'inherit_from': ['gold_base'],
+      },
+    }, # end of configurations
+  },
+
+  'includes': [
+    '<(DEPTH)/starboard/linux/shared/gyp_configuration.gypi',
+    '<(DEPTH)/starboard/linux/shared/compiler_flags.gypi',
+  ],
+
+  'variables': {
+    'gl_type': 'system_gles2',
+
+    'platform_libraries': [
+      '-lEGL',
+      '-lGLESv2',
+      '-lwayland-egl',
+      '-lwayland-client',
+    ],
+    'linker_flags': [
+      '-Wl,--wrap=eglGetDisplay',
+    ],
+  },
+}
diff --git a/src/starboard/contrib/linux/x64wl/gyp_configuration.py b/src/starboard/contrib/linux/x64wl/gyp_configuration.py
new file mode 100644
index 0000000..6c2e7ed
--- /dev/null
+++ b/src/starboard/contrib/linux/x64wl/gyp_configuration.py
@@ -0,0 +1,57 @@
+# Copyright 2017 Google Inc. All Rights Reserved.
+#
+# 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
+#
+#     http://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.
+"""Starboard Linux X64 Wayland platform configuration."""
+
+from starboard.linux.shared import gyp_configuration as shared_configuration
+from starboard.tools.toolchain import ar
+from starboard.tools.toolchain import bash
+from starboard.tools.toolchain import clang
+from starboard.tools.toolchain import clangxx
+from starboard.tools.toolchain import cp
+from starboard.tools.toolchain import touch
+
+
+class LinuxX64WaylandConfiguration(shared_configuration.LinuxConfiguration):
+  """Starboard Linux X64 Wayland platform configuration."""
+
+  def __init__(self,
+               platform_name='linux-x64wl',
+               asan_enabled_by_default=False,
+               goma_supports_compiler=True):
+    super(LinuxX64WaylandConfiguration, self).__init__(
+        platform_name, asan_enabled_by_default, goma_supports_compiler)
+
+  def GetTargetToolchain(self):
+    return self.GetHostToolchain()
+
+  def GetHostToolchain(self):
+    environment_variables = self.GetEnvironmentVariables()
+    cc_path = environment_variables['CC']
+    cxx_path = environment_variables['CXX']
+
+    return [
+        clang.CCompiler(path=cc_path),
+        clang.CxxCompiler(path=cxx_path),
+        clang.AssemblerWithCPreprocessor(path=cc_path),
+        ar.StaticThinLinker(),
+        ar.StaticLinker(),
+        clangxx.ExecutableLinker(path=cxx_path),
+        cp.Copy(),
+        touch.Stamp(),
+        bash.Shell(),
+    ]
+
+
+def CreatePlatformConfig():
+  return LinuxX64WaylandConfiguration()
diff --git a/src/starboard/contrib/linux/x64wl/main.cc b/src/starboard/contrib/linux/x64wl/main.cc
new file mode 100644
index 0000000..c835977
--- /dev/null
+++ b/src/starboard/contrib/linux/x64wl/main.cc
@@ -0,0 +1,36 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// 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
+//
+//     http://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 <time.h>
+
+#include "starboard/configuration.h"
+#include "starboard/shared/signal/crash_signals.h"
+#include "starboard/shared/signal/suspend_signals.h"
+#include "starboard/shared/starboard/link_receiver.h"
+#include "starboard/shared/wayland/application_wayland.h"
+
+extern "C" SB_EXPORT_PLATFORM int main(int argc, char** argv) {
+  tzset();
+  starboard::shared::signal::InstallCrashSignalHandlers();
+  starboard::shared::signal::InstallSuspendSignalHandlers();
+  starboard::shared::wayland::ApplicationWayland application;
+  int result = 0;
+  {
+    starboard::shared::starboard::LinkReceiver receiver(&application);
+    result = application.Run(argc, argv);
+  }
+  starboard::shared::signal::UninstallSuspendSignalHandlers();
+  starboard::shared::signal::UninstallCrashSignalHandlers();
+  return result;
+}
diff --git a/src/starboard/contrib/linux/x64wl/player_output_mode_supported.cc b/src/starboard/contrib/linux/x64wl/player_output_mode_supported.cc
new file mode 100644
index 0000000..91978c0
--- /dev/null
+++ b/src/starboard/contrib/linux/x64wl/player_output_mode_supported.cc
@@ -0,0 +1,39 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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
+//
+//     http://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 "starboard/player.h"
+
+#include "starboard/configuration.h"
+#include "starboard/log.h"
+#include "starboard/shared/starboard/player/filter/video_decoder_internal.h"
+
+#if SB_HAS(PLAYER_WITH_URL)
+
+bool SbPlayerOutputModeSupportedWithUrl(SbPlayerOutputMode output_mode) {
+  // Stub.
+  return false;
+}
+
+#else
+
+bool SbPlayerOutputModeSupported(SbPlayerOutputMode output_mode,
+                                 SbMediaVideoCodec codec,
+                                 SbDrmSystem drm_system) {
+  if (kSbPlayerOutputModePunchOut == output_mode)
+    return false;
+  return starboard::shared::starboard::player::filter::VideoDecoder::
+      OutputModeSupported(output_mode, codec, drm_system);
+}
+
+#endif  // SB_HAS(PLAYER_WITH_URL)
diff --git a/src/starboard/contrib/linux/x64wl/starboard_platform.gyp b/src/starboard/contrib/linux/x64wl/starboard_platform.gyp
new file mode 100644
index 0000000..3b085fa
--- /dev/null
+++ b/src/starboard/contrib/linux/x64wl/starboard_platform.gyp
@@ -0,0 +1,35 @@
+# Copyright 2017 Google Inc. All Rights Reserved.
+#
+# 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
+#
+#     http://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.
+{
+  'includes': [
+    'starboard_platform.gypi'
+  ],
+  'targets': [
+    {
+      'target_name': 'starboard_platform',
+      'type': 'static_library',
+      'sources': [
+        '<@(starboard_platform_sources)',
+      ],
+      'defines': [
+        # This must be defined when building Starboard, and must not when
+        # building Starboard client code.
+        'STARBOARD_IMPLEMENTATION',
+      ],
+      'dependencies': [
+        '<@(starboard_platform_dependencies)',
+      ],
+    },
+  ],
+}
diff --git a/src/starboard/contrib/linux/x64wl/starboard_platform.gypi b/src/starboard/contrib/linux/x64wl/starboard_platform.gypi
new file mode 100644
index 0000000..78a4930
--- /dev/null
+++ b/src/starboard/contrib/linux/x64wl/starboard_platform.gypi
@@ -0,0 +1,44 @@
+# Copyright 2016 Google Inc. All Rights Reserved.
+#
+# 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
+#
+#     http://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.
+{
+  'includes': ['<(DEPTH)/starboard/linux/shared/starboard_platform.gypi'],
+
+  'variables': {
+    'starboard_platform_sources': [
+      '<(DEPTH)/starboard/contrib/linux/x64wl/main.cc',
+      '<(DEPTH)/starboard/contrib/linux/x64wl/system_get_property.cc',
+      '<(DEPTH)/starboard/contrib/linux/x64wl/player_output_mode_supported.cc',
+      '<(DEPTH)/starboard/shared/starboard/link_receiver.cc',
+      '<(DEPTH)/starboard/shared/wayland/application_wayland.cc',
+      '<(DEPTH)/starboard/shared/wayland/dev_input.cc',
+      '<(DEPTH)/starboard/shared/wayland/egl_workaround.cc',
+      '<(DEPTH)/starboard/shared/wayland/native_display_type.cc',
+      '<(DEPTH)/starboard/shared/wayland/window_create.cc',
+      '<(DEPTH)/starboard/shared/wayland/window_destroy.cc',
+      '<(DEPTH)/starboard/shared/wayland/window_get_platform_handle.cc',
+      '<(DEPTH)/starboard/shared/wayland/window_get_size.cc',
+      '<(DEPTH)/starboard/shared/wayland/window_internal.cc',
+    ],
+    'starboard_platform_sources!': [
+      '<(DEPTH)/starboard/shared/linux/dev_input/dev_input.cc',
+      '<(DEPTH)/starboard/shared/linux/dev_input/dev_input.h',
+      '<(DEPTH)/starboard/shared/starboard/player/player_output_mode_supported.cc',
+    ],
+  },
+  'target_defaults': {
+    'include_dirs!': [
+          '<(DEPTH)/third_party/khronos',
+    ],
+  },
+}
diff --git a/src/starboard/contrib/linux/x64wl/system_get_property.cc b/src/starboard/contrib/linux/x64wl/system_get_property.cc
new file mode 100644
index 0000000..a9651c5
--- /dev/null
+++ b/src/starboard/contrib/linux/x64wl/system_get_property.cc
@@ -0,0 +1,122 @@
+// Copyright 2016 Google Inc. All Rights Reserved.
+//
+// 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
+//
+//     http://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 "starboard/system.h"
+
+#include <netdb.h>
+#include <linux/if.h>  // NOLINT(build/include_alpha)
+#include <sys/ioctl.h>
+#include <sys/socket.h>
+
+#include "starboard/log.h"
+#include "starboard/string.h"
+
+namespace {
+
+const char* kFriendlyName = "Linux Desktop";
+const char* kPlatformName = "Wayland; Linux x86_64";
+
+bool CopyStringAndTestIfSuccess(char* out_value,
+                                int value_length,
+                                const char* from_value) {
+  if (SbStringGetLength(from_value) + 1 > value_length)
+    return false;
+  SbStringCopy(out_value, from_value, value_length);
+  return true;
+}
+
+#if SB_API_VERSION < SB_PROPERTY_UUID_REMOVED_API_VERSION
+
+bool GetPlatformUuid(char* out_value, int value_length) {
+  struct ifreq interface;
+  struct ifconf config;
+  char buf[1024];
+
+  int fd = socket(AF_INET, SOCK_DGRAM, IPPROTO_IP);
+  if (fd == -1) {
+    return false;
+  }
+  config.ifc_len = sizeof(buf);
+  config.ifc_buf = buf;
+  int result = ioctl(fd, SIOCGIFCONF, &config);
+  if (result == -1) {
+    return false;
+  }
+
+  struct ifreq* cur_interface = config.ifc_req;
+  const struct ifreq* const end = cur_interface +
+      (config.ifc_len / sizeof(struct ifreq));
+
+  for (; cur_interface != end; ++cur_interface) {
+    SbStringCopy(interface.ifr_name,
+        cur_interface->ifr_name,
+        sizeof(cur_interface->ifr_name));
+    if (ioctl(fd, SIOCGIFFLAGS, &interface) == -1) {
+      continue;
+    }
+    if (interface.ifr_flags & IFF_LOOPBACK) {
+      continue;
+    }
+    if (ioctl(fd, SIOCGIFHWADDR, &interface) == -1) {
+      continue;
+    }
+    SbStringFormatF(out_value, value_length, "%x:%x:%x:%x:%x:%x",
+        interface.ifr_addr.sa_data[0], interface.ifr_addr.sa_data[1],
+        interface.ifr_addr.sa_data[2], interface.ifr_addr.sa_data[3],
+        interface.ifr_addr.sa_data[4], interface.ifr_addr.sa_data[5]);
+    return true;
+  }
+  return false;
+}
+
+#endif   // SB_API_VERSION < SB_PROPERTY_UUID_REMOVED_API_VERSION
+
+}  // namespace
+
+bool SbSystemGetProperty(SbSystemPropertyId property_id,
+                         char* out_value,
+                         int value_length) {
+  if (!out_value || !value_length) {
+    return false;
+  }
+
+  switch (property_id) {
+    case kSbSystemPropertyBrandName:
+    case kSbSystemPropertyChipsetModelNumber:
+    case kSbSystemPropertyFirmwareVersion:
+    case kSbSystemPropertyModelName:
+    case kSbSystemPropertyModelYear:
+    case kSbSystemPropertyNetworkOperatorName:
+    case kSbSystemPropertySpeechApiKey:
+      return false;
+
+    case kSbSystemPropertyFriendlyName:
+      return CopyStringAndTestIfSuccess(out_value, value_length, kFriendlyName);
+
+    case kSbSystemPropertyPlatformName:
+      return CopyStringAndTestIfSuccess(out_value, value_length, kPlatformName);
+
+#if SB_API_VERSION < SB_PROPERTY_UUID_REMOVED_API_VERSION
+    case kSbSystemPropertyPlatformUuid:
+      return GetPlatformUuid(out_value, value_length);
+#endif  // SB_API_VERSION < SB_PROPERTY_UUID_REMOVED_API_VERSION
+
+    default:
+      SB_DLOG(WARNING) << __FUNCTION__
+                       << ": Unrecognized property: " << property_id;
+      break;
+  }
+
+  return false;
+}
diff --git a/src/starboard/contrib/linux/x64wl/thread_types_public.h b/src/starboard/contrib/linux/x64wl/thread_types_public.h
new file mode 100644
index 0000000..f8df35f
--- /dev/null
+++ b/src/starboard/contrib/linux/x64wl/thread_types_public.h
@@ -0,0 +1,22 @@
+// Copyright 2017 Google Inc. All Rights Reserved.
+//
+// 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
+//
+//     http://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.
+
+// Includes threading primitive types and initializers.
+
+#ifndef STARBOARD_CONTRIB_LINUX_X64WL_THREAD_TYPES_PUBLIC_H_
+#define STARBOARD_CONTRIB_LINUX_X64WL_THREAD_TYPES_PUBLIC_H_
+
+#include "starboard/linux/shared/thread_types_public.h"
+
+#endif  // STARBOARD_CONTRIB_LINUX_X64WL_THREAD_TYPES_PUBLIC_H_