我用6个线程编写了一个程序,在我的CORE I7中运行正常,但是当我在CELERON中运行它时不起作用。似乎线程停止工作。
public function get($default)
{
$locale = $default;
if (!Session::has($this->sessionIdentifier)) {
$locale = Session::get($this->sessionIdentifier);
}
return $locale;
}
答案 0 :(得分:0)
由于我们不知道你的线程方法做了什么,我们不能提供太多,但你至少可以简化其中一个:
选项1
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
Timer1.Enabled = True
' Runs all in parallel (give or take the scheduler and duration)
Task.Run(Sub() ThreadTask())
Task.Run(Sub() barreras())
Task.Run(Sub() sensores())
Task.Run(Sub() convierte())
Task.Run(Sub() tiquet())
Task.Run(Sub() actualiza_grilla())
Me.DataGridView1.FirstDisplayedScrollingRowIndex = Me.DataGridView1.RowCount - 1
'Select the last row.
Me.DataGridView1.Rows(Me.DataGridView1.RowCount - 1).Selected = True
End Sub
选项2
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles Me.Load
Timer1.Enabled = True
Task.Run(Sub() AllThreads())
Me.DataGridView1.FirstDisplayedScrollingRowIndex = Me.DataGridView1.RowCount - 1
'Select the last row.
Me.DataGridView1.Rows(Me.DataGridView1.RowCount - 1).Selected = True
End Sub
Sub AllThreads()
' Runs each in series
ThreadTask()
barreras()
sensores()
convierte()
tiquet()
actualiza_grilla()
End Sub