RuntimeThreadData.h 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft Corporation and contributors. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. #pragma once
  6. #include <list>
  7. class RuntimeThreadData
  8. {
  9. public:
  10. RuntimeThreadData();
  11. ~RuntimeThreadData();
  12. HANDLE hevntInitialScriptCompleted;
  13. HANDLE hevntReceivedBroadcast;
  14. HANDLE hevntShutdown;
  15. HANDLE hSemaphore;
  16. HANDLE hThread;
  17. JsSharedArrayBufferContentHandle sharedContent;
  18. JsValueRef receiveBroadcastCallbackFunc;
  19. JsRuntimeHandle runtime;
  20. JsContextRef context;
  21. std::string initialSource;
  22. RuntimeThreadData* parent;
  23. std::list<RuntimeThreadData*> children;
  24. CRITICAL_SECTION csReportQ;
  25. std::list<std::string> reportQ;
  26. bool leaving;
  27. DWORD ThreadProc();
  28. };
  29. struct RuntimeThreadLocalData
  30. {
  31. // can't use ctor/dtor because it's not supported in VS2012
  32. // error C2483: 'threadLocalData' : object with constructor or destructor cannot be declared 'thread'
  33. void Initialize(RuntimeThreadData* threadData);
  34. void Uninitialize();
  35. RuntimeThreadData* threadData;
  36. };
  37. RuntimeThreadLocalData& GetRuntimeThreadLocalData();