#include <minipal/random.h>
#include "gcenv.h"
+#include "thread.h"
+#include "threadstore.h"
+#include "threadstore.inl"
#ifndef DIRECTORY_SEPARATOR_CHAR
#ifdef TARGET_UNIX
ep_rt_thread_handle_t thread,
EventPipeStackContents *stack_contents)
{
- PalDebugBreak();
+ // NativeAOT does not support getting the call stack
return false;
}
#endif
}
+ep_rt_thread_handle_t ep_rt_aot_thread_get_handle (void)
+{
+ return ThreadStore::GetCurrentThreadIfAvailable();
+}
+
+ep_rt_thread_id_t ep_rt_aot_thread_get_id (ep_rt_thread_handle_t thread_handle)
+{
+ return thread_handle->GetPalThreadIdForLogging();
+}
#ifdef EP_CHECKED_BUILD
if (RhConfig::Environment::TryGetBooleanValue("EventPipeEnableStackwalk", &value))
return value;
- return true;
+ return false;
}
/*
ep_rt_thread_get_handle (void)
{
STATIC_CONTRACT_NOTHROW;
- // shipping criteria: no EVENTPIPE-NATIVEAOT-TODO left in the codebase
- // TODO: Implement thread creation/management if needed
- // return GetThreadNULLOk ();
- return NULL;
+
+ extern ep_rt_thread_handle_t ep_rt_aot_thread_get_handle (void);
+ return ep_rt_aot_thread_get_handle();
}
static
ep_rt_thread_get_id (ep_rt_thread_handle_t thread_handle)
{
STATIC_CONTRACT_NOTHROW;
- EP_ASSERT (thread_handle != NULL);
- // shipping criteria: no EVENTPIPE-NATIVEAOT-TODO left in the codebase
- // TODO: Implement thread creation/management if needed
- // return ep_rt_uint64_t_to_thread_id_t (thread_handle->GetOSThreadId64 ());
- // PalDebugBreak();
- return 0;
+ extern ep_rt_thread_id_t ep_rt_aot_thread_get_id (ep_rt_thread_handle_t thread_handle);
+ return ep_rt_aot_thread_get_id(thread_handle);
}
static
ep_rt_thread_get_activity_id_handle (void)
{
STATIC_CONTRACT_NOTHROW;
- // shipping criteria: no EVENTPIPE-NATIVEAOT-TODO left in the codebase
- // TODO: Implement thread creation/management if needed
- // return GetThread ();
- // PalDebugBreak();
- return NULL;
+ return ep_rt_thread_get_or_create();
}
static
const uint8_t *
ep_rt_thread_get_activity_id_cref (ep_rt_thread_activity_id_handle_t activity_id_handle)
{
- STATIC_CONTRACT_NOTHROW;
- EP_ASSERT (activity_id_handle != NULL);
-
- // shipping criteria: no EVENTPIPE-NATIVEAOT-TODO left in the codebase
- // TODO: Implement thread creation/management if needed
- // return reinterpret_cast<const uint8_t *>(activity_id_handle->GetActivityId ());
- // PalDebugBreak();
+ EP_UNREACHABLE ("EP_THREAD_INCLUDE_ACTIVITY_ID should have been defined on NativeAOT");
return NULL;
}
EP_ASSERT (activity_id != NULL);
EP_ASSERT (activity_id_len == EP_ACTIVITY_ID_SIZE);
- memcpy (activity_id, ep_rt_thread_get_activity_id_cref (activity_id_handle), EP_ACTIVITY_ID_SIZE);
+ memcpy (activity_id, ep_thread_get_activity_id_cref (activity_id_handle), EP_ACTIVITY_ID_SIZE);
}
static
EP_ASSERT (activity_id != NULL);
EP_ASSERT (activity_id_len == EP_ACTIVITY_ID_SIZE);
- // shipping criteria: no EVENTPIPE-NATIVEAOT-TODO left in the codebase
- // TODO: Implement thread creation/management if needed
- // activity_id_handle->SetActivityId (reinterpret_cast<LPCGUID>(activity_id));
- // PalDebugBreak();
+ memcpy (ep_thread_get_activity_id_ref (activity_id_handle), activity_id, EP_ACTIVITY_ID_SIZE);
}
#undef EP_YIELD_WHILE