| 118 | } |
| 119 | |
| 120 | int ElasticCTRPredictorApi::init(const char *path, |
| 121 | const char *slot_conf_file, |
| 122 | const char *serving_conf_file) { |
| 123 | int ret = api_.create(path, serving_conf_file); |
| 124 | if (ret != 0) { |
| 125 | return ret; |
| 126 | } |
| 127 | |
| 128 | ret = read_slot_conf(path, slot_conf_file); |
| 129 | if (ret != 0) { |
| 130 | return ret; |
| 131 | } |
| 132 | |
| 133 | // Thread-local storage |
| 134 | if (pthread_key_create(&tls_bspec_key_, thread_resource_delete) != 0) { |
| 135 | LOG(ERROR) << "unable to create tls_bthread_key of thrd_data"; |
| 136 | return -1; |
| 137 | } |
| 138 | |
| 139 | return 0; |
| 140 | } |
| 141 | |
| 142 | int ElasticCTRPredictorApi::thrd_initialize() { |
| 143 | api_.thrd_initialize(); |