ipccounter: Inter-process counter

Description Usage Arguments Value Examples

Description

Inter-process counter

Usage

1
2
3
4
5
yield(id)

value(id)

reset(id, n = 1)

Arguments

id

character(1) counter or mutex identifier

n

integer(1) value from which yield() will increment.

Value

yield() returns an integer(1) value representing the next number in sequence. The first value returned is 1.

value() returns the value to be returned by the next call to yield(), without incrementing the counter. If the counter is not longer available, yield() returns NA.

reset() returns n, invisibly.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
id <- ipcid("cnt-example")

yield(id)
yield(id)

value(id)
yield(id)

reset(id, 10)
value(id)
yield(id)

ipcremove(id)

mtmorgan/IPCMutex documentation built on May 23, 2019, 9:34 a.m.