通过 Process.Start() 从多个线程启动可执行文件
我正在使用“7z.exe”在我的应用程序(c#)中做一些额外的工作。我已将“7z.exe”作为资源文件嵌入到我的应用程序的主可执行文件中。在执行我的应用程序期间,我将“7z.exe”提取到硬盘上并通过 Process.Start() 执行它。
我需要从多个线程多次执行“7z.exe”。 从多个线程访问相同的“7z.exe”文件是否安全?或者我应该为每个进程提取单独的“7z.exe”(到硬盘上的不同位置)。Start()
PS:7z.exe属于用c/c++编写的Seven-zip软件。
I am using "7z.exe" to do some extra work in my application(c#).I have embedded "7z.exe" in the main executable of my application as a resource file. During execution of my application i extract "7z.exe" on a hard-disk and execute it through Process.Start().
I need to execute "7z.exe" multiple times and from multiple threads.
Is it safe to access same "7z.exe" file from multiple threads? or should i extract separate "7z.exe" (to different location on hard-disk) for each process.Start()
PS:7z.exe belongs to Seven-zip software which is written in c/c++.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
是的,您应该能够从同一个可执行文件启动多个进程 - 假设该进程本身不执行任何操作来阻止这种情况(这是可行的 - 您必须检查 7-zip)。你绝对不能使用 SharpZipLib 这样的 zip 库来做你想做的事情吗?
Yes, you should be able to start multiple processes from the same executable file - assuming the process doesn't do anything itself to prevent that (which is feasible - you'd have to check for 7-zip). Can you definitely not do what you want using a zip library such as SharpZipLib?
是的,从不同的进程/线程执行相同的 exe 文件是安全的。
Yes, it's safe to execute same exe file from different processes/threads.