treelite
c_api_error.cc
Go to the documentation of this file.
1 
7 #include <dmlc/thread_local.h>
8 #include "./c_api_error.h"
9 
11  std::string last_error;
12 };
13 
14 typedef dmlc::ThreadLocalStore<TreeliteAPIErrorEntry> TreeliteAPIErrorStore;
15 
16 const char* TreeliteGetLastError() {
17  return TreeliteAPIErrorStore::Get()->last_error.c_str();
18 }
19 
20 void TreeliteAPISetLastError(const char* msg) {
21  TreeliteAPIErrorStore::Get()->last_error = msg;
22 }
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:16
Error handling for C API.
Definition: c_api_error.cc:10
void TreeliteAPISetLastError(const char *msg)
Set the last error message needed by C API.
Definition: c_api_error.cc:20