经过大量的研究,在阅读并尝试了所有问题后,我认为是时候向我寻求帮助了.
我在C#中有一个应用程序,我正在尝试使用不同的线程在SAME文件中编写.
public static void LaunchThreads(string path_file)
{
int i = 0;
Dictionary<int, Thread> threadsdico = new Dictionary<int, Thread>();
while (i < MAX_THREAD)
{
Thread thread = new Thread(() => ThreadEntryWriter(string path_file));
thread.Name = string.Format("ThreadsWriters{0}", i);
threadsdico.Add(i, thread);
thread.Start();
i++;
}
int zz = 0;
while (zz < threadsdico.Count())
{
threadsdico[zz].Join();
zz++;
}
}
private static readonly Object obj = new Object();
public static void ThreadEntryWriter(string path_file)
{
int w = 0;
while (w < 99)
{
string newline = …
Run Code Online (Sandbox Code Playgroud)