gpt4 book ai didi

c++ - 在 ONC RPC 中,从两个注册了不同程序的线程调用 svc_run() 是否有效?

转载 作者:太空狗 更新时间:2023-10-29 22:53:42 25 4
gpt4 key购买 nike

在我们支持多平台(Linux、Solaris 和 Windows)并使用 C 和 C++ 编码的项目中,我们使用 ONC RPC 进行 IPC。最近需要有一个应用服务器来处理两个不同的程序。

我已经尝试了以下测试。

创建了一个多线程应用程序 在其中创建了两个工作线程

    In first thread I’m
a) Creating a TCP transport
b) Registering the transport
c) Calling svc_run

In second thread I’
a) Creating a second TCP transport
b) Registering the transport with a different program no
c) Calling svc_run*

我已经在 Red Hat Linux 上试过了4,对我来说效果很好。

但是在两个不同的线程中注册两个程序no并调用svc_run是否有效?

我曾尝试在互联网上搜索,但找不到任何明确的信息。

最佳答案

这似乎是合乎逻辑的,尽管我自己从未尝试过。

请注意 rpcgen IDL 编译器的 -M 命令开关(这是来自 Solaris 上的 man 页面):

 -M          Generates multithread-safe stubs for passing
arguments and results between rpcgen-
generated code and user written code. This
option is useful for users who want to use
threads in their code.

如果代理/ stub 代码是线程安全的,并且您使用 2 个不同的 RPC 进程号注册了两个事件循环——我猜这应该表现得好像您实际上有 2 个不同的进程(RPC 方式)。

关于c++ - 在 ONC RPC 中,从两个注册了不同程序的线程调用 svc_run() 是否有效?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1178830/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com