Skip to content
A simple toy example of goroutine-like function go.socket which allows code to be executed in a non-blocking manner on a socket server
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
R
inst
man
.Rbuildignore
.gitattributes
.gitignore
DESCRIPTION
LICENSE
NAMESPACE
README.md
gosocket.Rproj

README.md

Use the future package

The functionality demonstrated in this toy example is better implemented in the future package already.

gosocket

Allows for simple go-routine like execution of code (as in syntax but NOT in lightweight-ness) in a non-blocking manner on socket server.

Install

install.packages("devtools") #if not already installed
devtools::install_github("AnalytixWare/gosocket")

Usage

library(gosocket)
system.time(gs <- go.socket("z <- rnorm(10^8)")) # go.socket is non-blocking the rest of the code will execute almost immediately
print("Don't have to wait for it to finish") 
evalServer.nb(gs$con,"summary(z)") # to retrieve the results; this is blocking
print("The above you have to wait for!")
close.go.socket(gs) # good practise to close the go.socket
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.