ref: cd0ee83393798db7d2c26813b13be2a3039ad7c7
parent: d0086b1940c63df724a4bb609b6cab32c2e66b95
author: Martin Storsjö <[email protected]>
date: Tue Dec 17 09:17:52 EST 2013
Don't call process affinity functions in windows store or windows phone apps These functions are only available in the desktop api subset.
--- a/codec/console/enc/src/welsenc.cpp
+++ b/codec/console/enc/src/welsenc.cpp
@@ -83,6 +83,17 @@
#include "WelsThreadLib.h"
#endif//MT_ENABLED
+#ifdef WIN32
+#ifdef WINAPI_FAMILY
+#include <winapifamily.h>
+#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)
+#define HAVE_PROCESS_AFFINITY
+#endif
+#else /* defined(WINAPI_FAMILY) */
+#define HAVE_PROCESS_AFFINITY
+#endif
+#endif /* WIN32 */
+
#include <iostream>
using namespace std;
using namespace WelsSVCEnc;
@@ -1207,7 +1218,7 @@
// Merge from Heifei's Wonder. Lock process to a single core
void LockToSingleCore() {
-#if defined(WIN32)
+#ifdef HAVE_PROCESS_AFFINITY
//for 2005 compiler, change "DWORD" to "DWORD_PTR"
ULONG_PTR ProcessAffMask = 0, SystemAffMask = 0;
HANDLE hProcess = GetCurrentProcess();