Background Respawn threading model timeout increased and made configurable from PluginDebugger

This commit is contained in:
Michele Lunardi 2021-03-10 11:14:17 +01:00
parent 40601388ee
commit 728d522f4f
3 changed files with 14 additions and 6 deletions

View File

@ -53,8 +53,16 @@ namespace Acacia
}
private static readonly EnumOption<Threading> THREADING = new EnumOption<Threading>("Threading", Threading.BackgroundRespawn);
[AcaciaOption("Enables or disables ZPush account checking. To enable advanced features, it must be known " +
"which accounts use ZPush servers. This option checks responses from ActiveSync servers to " +
[AcaciaOption("Sets respawn timeout for BackgroundRespawn threading model.")]
public int ThreadingRespawnTimeout
{
get { return GetOption(null, THREADING_RESPONSE_TIMEOUT); }
set { SetOption(null, THREADING_RESPONSE_TIMEOUT, value); }
}
private static readonly IntOption THREADING_RESPONSE_TIMEOUT = new IntOption("ThreadingRespawnTimeout", 15000);
[AcaciaOption("Enables or disables ZPush account checking. To enable advanced features, it must be known " +
"which accounts use ZPush servers. This option checks responses from ActiveSync servers to " +
"identify the ZPush ones.")]
public bool ZPushCheck
{

View File

@ -148,7 +148,7 @@ namespace Acacia.Utils
_executor = new TasksBackground();
break;
case DebugOptions.Threading.BackgroundRespawn:
_executor = new TasksBackgroundRespawn();
_executor = new TasksBackgroundRespawn(GlobalOptions.INSTANCE.ThreadingRespawnTimeout);
break;
}

View File

@ -28,10 +28,10 @@ namespace Acacia.Utils
public class TasksBackgroundRespawn : TaskExecutor
{
private readonly BlockingCollection<AcaciaTask> _tasks = new BlockingCollection<AcaciaTask>();
public static int TIMEOUT_MS = 5000;
public TasksBackgroundRespawn()
public static int TIMEOUT_MS;
public TasksBackgroundRespawn(int timeout_ms)
{
TIMEOUT_MS = timeout_ms;
Thread t = new Thread(Watcher);
t.SetApartmentState(ApartmentState.STA);
t.Start();