kdb进程间通信并迫使进程挂起

问题描述 投票:0回答:1

我想知道我是否有两个kdb进程A和B,并且像这样从A执行同步调用:

h(`function_defined_on_b; args);

A将挂起,直到执行function_defined_on_b。但是,如果function_defined_on_b需要调用A怎么办?我认为它将无法执行,因为由于A当前正在挂起,因此对A的调用将超时。我知道从A到B进行异步调用可以解决此问题,但是如果我不希望A继续运行直到完成此调用的代码,该怎么办?

或者,有什么方法可以阻止A在同步调用之后执行任何代码,但允许它执行来自其他进程的传入查询?

谢谢

kdb
1个回答
0
投票

实际上没有一种方法可以做您描述的事情。一种可能的解决方案是使某种网关/聚合器进程运行需要跨多个进程的数据的功能。称它为C:

Function to run on C:

aggFunc:{

  responseFromA:handleToA(`func;args);

  //process A is free at this point to process the call from B. 
  //process C can then wait for this response before sending the next part to A
  responseFromB:handleToB(`func;args);

  responseFromA2:handleToA(`func2;args);

  };
© www.soinside.com 2019 - 2024. All rights reserved.