mirror of
https://github.com/Flow-Launcher/Flow.Launcher.git
synced 2026-03-11 08:54:32 +00:00
Program plugin: remove lock
lock is not needed since assignment is atomic
This commit is contained in:
parent
bcf43640fa
commit
0816fdf318
1 changed files with 13 additions and 17 deletions
|
|
@ -14,7 +14,6 @@ namespace Wox.Plugin.Program
|
||||||
{
|
{
|
||||||
public class Main : ISettingProvider, IPlugin, IPluginI18n, IContextMenu, ISavable
|
public class Main : ISettingProvider, IPlugin, IPluginI18n, IContextMenu, ISavable
|
||||||
{
|
{
|
||||||
private static readonly object IndexLock = new object();
|
|
||||||
private static List<Program> _programs = new List<Program>();
|
private static List<Program> _programs = new List<Program>();
|
||||||
|
|
||||||
private PluginInitContext _context;
|
private PluginInitContext _context;
|
||||||
|
|
@ -88,24 +87,21 @@ namespace Wox.Plugin.Program
|
||||||
|
|
||||||
public static void IndexPrograms()
|
public static void IndexPrograms()
|
||||||
{
|
{
|
||||||
lock (IndexLock)
|
var sources = DefaultProgramSources();
|
||||||
|
if (_settings.ProgramSources != null &&
|
||||||
|
_settings.ProgramSources.Count(o => o.Enabled) > 0)
|
||||||
{
|
{
|
||||||
var sources = DefaultProgramSources();
|
sources.AddRange(_settings.ProgramSources);
|
||||||
if (_settings.ProgramSources != null &&
|
|
||||||
_settings.ProgramSources.Count(o => o.Enabled) > 0)
|
|
||||||
{
|
|
||||||
sources.AddRange(_settings.ProgramSources);
|
|
||||||
}
|
|
||||||
|
|
||||||
_programs = sources.AsParallel()
|
|
||||||
.SelectMany(s => s.LoadPrograms())
|
|
||||||
// filter duplicate program
|
|
||||||
.GroupBy(x => new { ExecutePath = x.Path, ExecuteName = x.ExecutableName })
|
|
||||||
.Select(g => g.First())
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
_cache.Programs = _programs;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_programs = sources.AsParallel()
|
||||||
|
.SelectMany(s => s.LoadPrograms())
|
||||||
|
// filter duplicate program
|
||||||
|
.GroupBy(x => new { ExecutePath = x.Path, ExecuteName = x.ExecutableName })
|
||||||
|
.Select(g => g.First())
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
_cache.Programs = _programs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue