Treelite
src
c_api
c_api_error.cc
Go to the documentation of this file.
1
7
#include <
treelite/thread_local.h
>
8
#include <
treelite/c_api_error.h
>
9
#include <string>
10
11
struct
TreeliteAPIErrorEntry
{
12
std::string last_error;
13
};
14
15
using
TreeliteAPIErrorStore
=
treelite::ThreadLocalStore<TreeliteAPIErrorEntry>
;
16
17
const
char
*
TreeliteGetLastError
() {
18
return
TreeliteAPIErrorStore::Get
()->last_error.c_str();
19
}
20
21
void
TreeliteAPISetLastError
(
const
char
* msg) {
22
TreeliteAPIErrorStore::Get
()->last_error = msg;
23
}
TreeliteGetLastError
const char * TreeliteGetLastError()
display last error; can be called by multiple threads Note. Each thread will get the last error occur...
Definition:
c_api_error.cc:17
thread_local.h
Helper class for thread-local storage.
c_api_error.h
Error handling for C API.
TreeliteAPIErrorEntry
Definition:
c_api_error.cc:11
TreeliteAPISetLastError
void TreeliteAPISetLastError(const char *msg)
Set the last error message needed by C API.
Definition:
c_api_error.cc:21
treelite::ThreadLocalStore
A thread-local storage.
Definition:
thread_local.h:17
treelite::ThreadLocalStore::Get
static T * Get()
Definition:
thread_local.h:20
Generated by
1.8.13