mirror of
https://github.com/cemu-project/DS4Windows.git
synced 2024-12-24 15:41:49 +01:00
Change thread affinity of BackgroundWorker
This commit is contained in:
parent
c8809f37cb
commit
1fedb61d2b
@ -41,9 +41,10 @@ namespace DS4Windows
|
|||||||
{
|
{
|
||||||
//sp.Stream = Properties.Resources.EE;
|
//sp.Stream = Properties.Resources.EE;
|
||||||
// Cause thread affinity to not be tied to main GUI thread
|
// Cause thread affinity to not be tied to main GUI thread
|
||||||
Task.Run(() => {
|
Task x360task = new Task(() => { Thread.CurrentThread.Priority = ThreadPriority.AboveNormal; x360Bus = new X360Device(); });
|
||||||
Thread.CurrentThread.Priority = ThreadPriority.AboveNormal;
|
x360task.Start();
|
||||||
x360Bus = new X360Device(); }).Wait();
|
while (!x360task.IsCompleted)
|
||||||
|
Thread.SpinWait(500);
|
||||||
|
|
||||||
AddtoDS4List();
|
AddtoDS4List();
|
||||||
|
|
||||||
|
@ -919,19 +919,19 @@ namespace DS4Windows
|
|||||||
|
|
||||||
protected void Form_Resize(object sender, EventArgs e)
|
protected void Form_Resize(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
if (FormWindowState.Minimized == this.WindowState)
|
if (FormWindowState.Minimized == WindowState)
|
||||||
{
|
{
|
||||||
this.Hide();
|
Hide();
|
||||||
this.ShowInTaskbar = false;
|
ShowInTaskbar = false;
|
||||||
this.FormBorderStyle = FormBorderStyle.None;
|
FormBorderStyle = FormBorderStyle.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (FormWindowState.Normal == this.WindowState)
|
else if (FormWindowState.Normal == WindowState)
|
||||||
{
|
{
|
||||||
//mAllowVisible = true;
|
//mAllowVisible = true;
|
||||||
this.Show();
|
Show();
|
||||||
this.ShowInTaskbar = true;
|
ShowInTaskbar = true;
|
||||||
this.FormBorderStyle = FormBorderStyle.Sizable;
|
FormBorderStyle = FormBorderStyle.Sizable;
|
||||||
}
|
}
|
||||||
|
|
||||||
chData.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
|
chData.AutoResize(ColumnHeaderAutoResizeStyle.HeaderSize);
|
||||||
|
@ -95,7 +95,7 @@ namespace DS4Windows
|
|||||||
|
|
||||||
// Create the Event handle
|
// Create the Event handle
|
||||||
threadComEvent = new EventWaitHandle(false, EventResetMode.ManualReset, SingleAppComEventName);
|
threadComEvent = new EventWaitHandle(false, EventResetMode.ManualReset, SingleAppComEventName);
|
||||||
CreateInterAppComThread();
|
System.Threading.Tasks.Task.Run(() => { Thread.CurrentThread.Priority = ThreadPriority.Lowest; CreateInterAppComThread(); }).Wait();
|
||||||
|
|
||||||
//if (mutex.WaitOne(TimeSpan.Zero, true))
|
//if (mutex.WaitOne(TimeSpan.Zero, true))
|
||||||
//{
|
//{
|
||||||
|
Loading…
Reference in New Issue
Block a user