queue-methods: Functions for queue operations

Description Usage Arguments Details Value Author(s) Examples

Description

A queue is a first-in-first-out (FIFO) data structure. The queue package provides a basic interface and implementation for queues. The packages also include “hook” for more sophisticated, inter-process messaging.

Usage

1
2
3
4

Arguments

type

The type of queue to create; default is basic.queue

q

The queue to push or pop values from

val

The value to push onto the queue

...

Other parameters

Details

By default the queue function creates a basic.queue which can be used on a single R process for sequential data storage. When distributed queues are used, as in the case with the redis.queue package arguments such as the shared resource name must be specified via the name parameter.

Value

queue returns the queue data structure.

push returns TRUE or FALSE depending on whether or not the push is successful.

pop returns the data at the head of the queue.

Author(s)

Michael Kane

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## Not run: 
# Background a simple R expression.
bg.comp <- bg({Sys.sleep(2); "Awake!\n"})

# If the calculation is not complete do something else.
if (!done(bg.comp)) {
  cat("Waiting for calculation\n")
}

# Output the result.
cat(fg(bg.comp))

## End(Not run)

queue documentation built on May 2, 2019, 6:48 p.m.