Skip to content

Commit

Permalink
Merge branch 'main' into optional_import_parent_build_prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Alan-Jowett authored Dec 6, 2023
2 parents b6b5786 + aa858ad commit b69809b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 4 additions & 0 deletions cxplat/src/cxplat_winuser/workitem_winuser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,10 @@ cxplat_winuser_initialize_thread_pool()
void
cxplat_wait_for_preemptible_work_items_complete()
{
if (!_pool) {
return;
}

cxplat_wait_for_rundown_protection_release(&_cxplat_preemptible_work_items_rundown_reference);
}

Expand Down
10 changes: 8 additions & 2 deletions src/platform_user.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ int32_t _usersim_platform_initiate_count = 0;
static uint32_t _usersim_platform_maximum_group_count = 0;
static uint32_t _usersim_platform_maximum_processor_count = 0;

static bool _cxplat_initialized = false;

// The starting index of the first processor in each group.
// Used to compute the current CPU index.
static std::vector<uint32_t> _usersim_platform_group_to_index_map;
Expand All @@ -59,6 +61,8 @@ usersim_platform_initiate()
goto Exit;
}

_cxplat_initialized = true;

try {
_usersim_platform_maximum_group_count = GetMaximumProcessorGroupCount();
_usersim_platform_maximum_processor_count = GetMaximumProcessorCount(ALL_PROCESSOR_GROUPS);
Expand Down Expand Up @@ -89,7 +93,6 @@ usersim_platform_initiate()
if (result != STATUS_SUCCESS) {
// Clean up since usersim_platform_terminate() will not be called by the caller.
usersim_platform_terminate();
cxplat_cleanup();
}
return result;
}
Expand All @@ -103,7 +106,10 @@ usersim_platform_terminate()
usersim_free_threadpool_timers();
usersim_clean_up_dpcs();
usersim_clean_up_irql();
cxplat_cleanup();
if (_cxplat_initialized) {
cxplat_cleanup();
_cxplat_initialized = false;
}

int32_t count = InterlockedDecrement((volatile long*)&_usersim_platform_initiate_count);
if (count < 0) {
Expand Down

0 comments on commit b69809b

Please sign in to comment.