mirror of
https://git.naxdy.org/Mirror/Ryujinx.git
synced 2025-01-13 14:19:12 +00:00
Ensure CimSession is properly disposed.
This commit is contained in:
parent
cc8f4f8a11
commit
31c36afc4c
1 changed files with 6 additions and 4 deletions
|
@ -93,13 +93,15 @@ namespace Ryujinx.Common.SystemInfo
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
{
|
{
|
||||||
var session = CimSession.Create(null);
|
using (var session = CimSession.Create(null))
|
||||||
|
{
|
||||||
var instances = session.QueryInstances(@"root\cimv2", "WQL", "SELECT NumberOfCores FROM Win32_Processor");
|
var instances = session.QueryInstances(@"root\cimv2", "WQL", "SELECT NumberOfCores FROM Win32_Processor");
|
||||||
foreach (CimInstance instance in instances)
|
foreach (CimInstance instance in instances)
|
||||||
{
|
{
|
||||||
coreCount = int.Parse(instance.CimInstanceProperties["NumberOfCores"].Value.ToString());
|
coreCount = int.Parse(instance.CimInstanceProperties["NumberOfCores"].Value.ToString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
||||||
{
|
{
|
||||||
string cpuCoresLine = File.ReadLines("/proc/cpuinfo").FirstOrDefault(line => line.Contains("cpu cores"));
|
string cpuCoresLine = File.ReadLines("/proc/cpuinfo").FirstOrDefault(line => line.Contains("cpu cores"));
|
||||||
|
|
Loading…
Reference in a new issue