Problem Version 1, Can we make pr_fun process it's retun without waiting for ch_fun() to finish
ch_fun <- function() {Sys.sleep(10)}
pr_fun <- function() {ch_fun(); return("Done")}
pr_fun()
Proble Actual Version
R session 1 as svSocket Server
library(svSocket)
startSocketServer(port = 9875,local=FALSE)
R session 2 as svSocket client
con <- socketConnection(port = 9875,host="127.0.0.1")
evalServer(con,"Sys.sleep(20)")
R session 3 as svSocket client
con <- socketConnection(port = 9875,host="127.0.0.1")
evalServer(con,"a=10")
If we run the code lines for session 2 and while server is processing Sys.sleep call we quickly put the code lines for session 3 in session 3 and abort the call it still gets processed. We can check that on server side by checking if object "a" was created.
My point is we didn't have to wait for job to finish in session 3 still it was processed so somehow jobs were piled up on session side and we don't have to wait for jobs to finish just send them to server and abort the waiting process and move ahead. We can manually abort using Ctrl+C or Esc but how can I do that in a function. I want pr_fun to call ch_fun in server session and proceed to its return immediately.