https://github.com/xiaodaigh/gosocket
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
https://github.com/xiaodaigh/gosocket
Last synced: 6 months ago
JSON representation
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
- Host: GitHub
- URL: https://github.com/xiaodaigh/gosocket
- Owner: xiaodaigh
- License: gpl-2.0
- Created: 2013-12-14T10:32:01.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2017-09-29T22:25:58.000Z (over 7 years ago)
- Last Synced: 2024-10-13T19:39:18.945Z (7 months ago)
- Language: R
- Homepage:
- Size: 39.1 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Use the future package
The functionality demonstrated in this toy example is better implemented in the [future package](https://cran.r-project.org/web/packages/future/vignettes/future-1-overview.html) 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
```r
install.packages("devtools") #if not already installed
devtools::install_github("AnalytixWare/gosocket")
```# Usage
```r
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
```