PengZheng commented on code in PR #536:
URL: https://github.com/apache/celix/pull/536#discussion_r1184700121


##########
libs/utils/src/celix_err.c:
##########
@@ -0,0 +1,166 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ *  KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+#include "celix_err.h"
+
+#include <stdarg.h>
+#include <stdio.h>
+#include <string.h>
+
+#ifndef CELIX_ERR_USE_THREAD_LOCAL
+#include <stdlib.h>
+#include "celix_threads.h"
+#endif
+
+typedef struct celix_err {
+    char buffer[CELIX_ERR_BUFFER_SIZE];
+    size_t pos;
+} celix_err_t;
+
+#ifdef CELIX_ERR_USE_THREAD_LOCAL
+
+__thread celix_err_t celix_err_tssErr = { .buffer = {0}, .pos = 0 };

Review Comment:
   From Drepper's paper, we have:
   
   > We will see that for performance reasons it is not always possible to use 
the lazy
   allocation of thread-local storage. At least the thread-local storage for 
the application
   itself and the initially loaded DSOs are usually always allocated right away.
   
   This is consistent with what we encountered in the past. Also note that 
utilis.so does belong to initially loaded DSOs (we may direct link it to the 
main application).



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@celix.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to