更新时间:2023-11-22 20:34:16
不可能:线程存在于进程内部 - 一旦进程终止,线程就会死掉。
您可能会设计面向服务的体系结构(SOA):
- 一个服务保存状态(你的线程)
- GUI实例与服务通信
干杯
Andi
Not possible: threads live inside of processes - once a process dies, the threads die too.
You might design a service oriented architecture (SOA):
- one service holds the state (your thread)
- the GUI instances communicate with the service
Cheers
Andi
Hello Yogesh,
你无法共享你的例子中的主题 EXE的另一个实例,你创建一个不同的进程来运行它。
每个进程使用它自己的内存空间。
您可能会重新考虑创建第二个流程,或者您可以使用进程间通信的各种方法之一( IPC ),例如:
- 命名管道
- 共享内存
- MSMQ
- 套接字
干杯,
Edo
Hello Yogesh,
You can not share the threads in your example since when you start another instance of the EXE, you create a different process for it to run in.
Each process uses it''s own memory "space".
You may re-think creating a second process OR you can one of the various methods for Inter-Process Communication (IPC), for example:
- Named Pipes
- Shared Mem
- MSMQ
- Sockets
Cheers,
Edo