retry pthread create if it failes with ENOKEY
@@ -651,7 +651,12 @@ CxPlatThreadCreate(
#else // CXPLAT_USE_CUSTOM_THREAD_CONTEXT
- if (pthread_create(Thread, &Attr, Config->Callback, Config->Context)) {
+ //
+ // If pthread_create fails with ENOKEY, then try again without the attribute
+ // because the CPU might be offline.
+ //
+ if (pthread_create(Thread, &Attr, Config->Callback, Config->Context) &&
+ (errno != ENOKEY || pthread_create(Thread, NULL, Config->Callback, Config->Context))) {
Status = errno;
QuicTraceEvent(
LibraryErrorStatus,
