Jiefei, Beyond the general response that Luke gave, to be a bit more specific to what you said, DATAPTR and INTEGER_GET_REGION involve ALTREP method execution (for ALTREP objects, obviously) so even they are not as simple and straightforward as they were a couple years ago. They should not (any longer) be thought of as being guaranteed to be essentially bare metal data retrieval from memory.
Best, ~G On Sun, Sep 13, 2020 at 6:49 AM <luke-tier...@uiowa.edu> wrote: > 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@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-tier...@uiowa.edu > Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu > > ______________________________________________ > R-devel@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-devel > [[alternative HTML version deleted]] ______________________________________________ R-devel@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-devel