데이터를 병렬로 실행하기 위해 tpl을 사용하고 있습니다. 문제는 때로는 그러한 출력을 제공하는 이유없이 중단 점이다이유없이 프로그램이 응답하지 않음
The thread '<No Name>' (0x4aa4) has exited with code 0 (0x0).
The thread '<No Name>' (0x2bf4) has exited with code 0 (0x0).
The thread '<No Name>' (0x417c) has exited with code 0 (0x0).
The thread '<No Name>' (0x432c) has exited with code 0 (0x0).
The thread '<No Name>' (0x3ad0) has exited with code 0 (0x0).
The thread '<No Name>' (0x4440) has exited with code 0 (0x0).
The thread '<No Name>' (0x24e8) has exited with code 0 (0x0).
The thread '<No Name>' (0x3354) has exited with code 0 (0x0).
The thread '<No Name>' (0x4a30) has exited with code 0 (0x0).
프로그램은 계속 실행된다 내가 foreach는 위해 병렬 절차를 어디 때 그것을 일시 비주얼 스튜디오에서 일시 중지 :
을Parallel.ForEach
(
hold1.remainingHolds.ToArray(),
subSequence =>
{
//only if subsequence has 1 common substring
if (checkIfCommon(remainingSequence, subSequence.ToString()) == 1)
{
goDownLinkType2(subSequence.ToString().Split(','), 0,
(SuffixNode)hold1.childHolds[subSequence.ToString().Split(',')[0]]);
}
}
);
나는 그것의 서로 다른 자원을 기다리고 evetually 잠금 스레드가있을 수있는 경우가없는 죽은 잠금 원인을 생각 해달라고 서로
는이 방법 안에 입력해야하며 다우에게 전까지 접미사 트리를 이동 recursivley 기다릴거야. 어떤 스레드가 ArrayList를
Boolean flag = false;
public void goDownLinkType2
(string[] splittedString,
int index, SuffixNode currentNode)
{
Boolean writingFlag = false;
if (index == 2)
{
while(writingFlag == false)
{
while(flag == true)
{
//blocked
}
if (flag == false)
{
flag = true;
if(!secondChoiceResults.Contains
(currentNode.representingStance.SequenceOfHolds))
{
Console.WriteLine("new addition");
secondChoiceResults.Add
(currentNode.representingStance.SequenceOfHolds,
currentNode.representingStance);
}
flag = false;
writingFlag = true;
}
}
}
else
{
int nextIndex = index + 1;
goDownLinkType2
(splittedString,
nextIndex,
(SuffixNode)currentNode.childHolds[splittedString[nextIndex]]
);
}
}
는'Parallel.ForEach' 결국 종료합니까 그렇습니다. 이것은 디자인에 의한 것입니다. 스레드 풀의 모든 스레드를 종료합니다. 귀하의 요청을 만족시키기 위해 전자 회전합니다. 스레드가 종료되지 않으면 하나 이상의 스레드를 열어 놓고있는 경계 조건이 있습니까? –
프로그램에서 종료 될 예정이지만이 경우 모든 데이터가 처리되지는 않았으므로이 단계에서 처리하면 안됩니다. 또한 나중에 도달하지 못한 중단 점에 도달하기로되어 있으며 프로그램은 foreach에서 중단됩니다. –
출력을 처리 종료로 해석 할 가능성이 있습니다. 실제로 'Parallel.ForEach'가 더 이상 이러한 스레드를 필요로하지 않고 스레드 풀을 스레드 풀로 릴리스 할 수 있습니까? 좀 더 구체적인 대답을 원한다면 breakpoint에 대한 정보, 즉 코드의 위치, 코드, 충돌 이유 등을 알려주십시오. –