tryLockRessource-character-method: Manage File System Ressource Lock Status

Description Usage Arguments Value Author(s) References See Also Examples

Description

See generic: tryLockRessource

Usage

1
2
3
## S4 method for signature 'character'
tryLockRessource(path, try_limit = 100,
  strict = FALSE, ...)

Arguments

path

character. File path.

try_limit

numeric. Limit for trying to lock ressource.

strict

logical. TRUE: when try_limit is reached, an error is thrown; FALSE: when try_limit is reached, method returns with FALSE.

...

Further arguments passed to subsequent functions/methods. In particular: isRessourceLocked, lockRessource.

Value

logical. TRUE: lock successful; FALSE: lock failed.

Author(s)

Janko Thyson janko.thyson@rappster.de

References

https://github.com/Rappster/filesystr

See Also

tryLockRessource

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Not run: 

## Example content //
path <- file.path(tempdir(), "test/registry.rdata")
file.create(path)
  
## File //
lockRessource(path = path)
tryLockRessource(path = path, try_limit = 3)
try(tryLockRessource(path = path, try_limit = 3, strict = TRUE))
unlockRessource(path = path)
tryLockRessource(path = path)
unlockRessource(path = path)

## Directory //
path <- dirname(path)
lockRessource(path = path)
tryLockRessource(path = path, try_limit = 3)
try(tryLockRessource(path = path, try_limit = 3, strict = TRUE))
unlockRessource(path = path)
tryLockRessource(path = path)
unlockRessource(path = path)

## Non-existing ressource //
expect_error(tryLockRessource(path = "abcd", strict = TRUE))


## End(Not run)

rappster/filesystr documentation built on May 26, 2019, 11:17 p.m.