|
25 | 25 | #' @param socket a Socket. |
26 | 26 | #' @param ... not used, present for compatibility purposes only. |
27 | 27 | #' |
28 | | -#' @return For \code{context}: a new Context (object of class 'nanoContext' and |
29 | | -#' 'nano'). |
30 | | -#' |
31 | | -#' For \code{.context}: an external pointer. |
| 28 | +#' @return A Context (object of class 'nanoContext' and 'nano'). |
32 | 29 | #' |
33 | 30 | #' @details Contexts allow the independent and concurrent use of stateful |
34 | 31 | #' operations using the same socket. For example, two different contexts |
|
45 | 42 | #' For nano objects, use the \code{$context_open()} method, which will |
46 | 43 | #' attach a new context at \code{$context}. See \code{\link{nano}}. |
47 | 44 | #' |
48 | | -#' \code{.context} is a performance variant of \code{context}, designed to |
49 | | -#' wrap a socket in a function argument when calling \code{\link{request}} |
50 | | -#' or \code{\link{reply}}. External pointers created by \code{.context} |
51 | | -#' are unclassed, hence methods for contexts such as \code{\link{close}} |
52 | | -#' will not work. However they function as a Context would when passed to |
53 | | -#' all messaging functions. The context is automatically closed when the |
54 | | -#' object is garbage collected. |
55 | | -#' |
56 | 45 | #' @examples |
57 | 46 | #' s <- socket("req", listen = "inproc://nanonext") |
58 | 47 | #' ctx <- context(s) |
59 | 48 | #' ctx |
60 | 49 | #' close(ctx) |
61 | | -#' r <- request(.context(s), "request data") |
62 | 50 | #' close(s) |
63 | 51 | #' |
64 | 52 | #' n <- nano("req", listen = "inproc://nanonext") |
|
73 | 61 | #' |
74 | 62 | context <- function(socket, ...) .Call(rnng_ctx_open, socket) |
75 | 63 |
|
76 | | -#' @rdname context |
| 64 | +#' Technical Utility: Open Context |
| 65 | +#' |
| 66 | +#' Open a new Context to be used with a Socket. This function is a performance |
| 67 | +#' variant of \code{\link{context}}, designed to wrap a socket in a function |
| 68 | +#' argument when calling \code{\link{request}} or \code{\link{reply}}. |
| 69 | +#' |
| 70 | +#' @param socket a Socket. |
| 71 | +#' |
| 72 | +#' @details External pointers created by this function are unclassed, hence |
| 73 | +#' methods for contexts such as \code{\link{close}} will not work. However |
| 74 | +#' they function as a Context would when passed to all messaging functions. |
| 75 | +#' The context is automatically closed when the object is garbage collected. |
| 76 | +#' |
| 77 | +#' @return An external pointer. |
| 78 | +#' |
| 79 | +#' @examples |
| 80 | +#' s <- socket("req", listen = "inproc://nanonext") |
| 81 | +#' r <- request(.context(s), "request data") |
| 82 | +#' close(s) |
| 83 | +#' |
77 | 84 | #' @export |
78 | 85 | #' |
79 | 86 | .context <- function(socket) .Call(rnng_ctx_create, socket) |
|
0 commit comments