[Rd] [External] Thread-safe R functions

iuke-tier@ey m@iii@g oii uiow@@edu iuke-tier@ey m@iii@g oii uiow@@edu
Sun Sep 13 15:48:49 CEST 2020


You should assume that NO functions or macros in the R API are
thread-safe.  If some happen to be now, on some platforms, they are
not guaranteed to be in the future. Even if you use a global lock you
need to keep in mind that any function in the R API can signal an
error and execute a longjmp, so you need to make sure you have set a
top level context in your thread.

Best,

luke

On Sun, 13 Sep 2020, Jiefei Wang wrote:

> Hi,
>
> I am curious about whether there exist thread-safe functions in
> `Rinternals.h`.  I know that R is single-threaded designed, but for the
> simple and straightforward functions like `DATAPTR` and `INTEGER_GET_REGION`,
> are these functions safe to call in a multi-thread environment?
>
> Best,
> Jiefei
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-devel using r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

-- 
Luke Tierney
Ralph E. Wareham Professor of Mathematical Sciences
University of Iowa                  Phone:             319-335-3386
Department of Statistics and        Fax:               319-335-3017
    Actuarial Science
241 Schaeffer Hall                  email:   luke-tierney using uiowa.edu
Iowa City, IA 52242                 WWW:  http://www.stat.uiowa.edu



More information about the R-devel mailing list