mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 22:23:29 -07:00
NavCategory: temporary resolution of the hang issue (#9)
This commit is contained in:
parent
37ba91257c
commit
3c7bda7bbb
1 changed files with 6 additions and 27 deletions
|
@ -62,33 +62,12 @@ bool IsGraphingModeAvailable()
|
|||
Box<bool> ^ _isGraphingModeEnabledCached = nullptr;
|
||||
bool IsGraphingModeEnabled()
|
||||
{
|
||||
if (!IsGraphingModeAvailable())
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_isGraphingModeEnabledCached != nullptr)
|
||||
{
|
||||
return _isGraphingModeEnabledCached->Value;
|
||||
}
|
||||
|
||||
User ^ firstUser;
|
||||
std::atomic_flag finished = ATOMIC_FLAG_INIT;
|
||||
|
||||
finished.test_and_set(std::memory_order_acquire); // acquire
|
||||
|
||||
create_task(User::FindAllAsync(UserType::LocalUser)).then([&firstUser, &finished](IVectorView<User ^> ^ users) {
|
||||
firstUser = users->GetAt(0);
|
||||
finished.clear(std::memory_order_release); // release
|
||||
}, task_continuation_context::use_arbitrary());
|
||||
|
||||
while (finished.test_and_set(std::memory_order_acquire)) // aquire
|
||||
; // spin
|
||||
|
||||
finished.clear(std::memory_order_release); // release
|
||||
|
||||
auto namedPolicyData = NamedPolicy::GetPolicyFromPathForUser(firstUser, L"Education", L"AllowGraphingCalculator");
|
||||
_isGraphingModeEnabledCached = namedPolicyData->GetBoolean() == true;
|
||||
// CSHARP_MIGRATION: TODO: merge PR ##1471 to fix below bug before we release to PROD
|
||||
#ifdef _DEBUG
|
||||
_isGraphingModeEnabledCached = true;
|
||||
#else
|
||||
throw "CSHARP_MIGRATION: EXCEPTION";
|
||||
#endif // _DEBUG
|
||||
|
||||
return _isGraphingModeEnabledCached->Value;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue