summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2019-10-28 04:19:56 +0000
committermidipix <writeonce@midipix.org>2019-11-20 03:00:40 +0000
commitc42bd5f05e744e0d863d0b10552d490377e06c63 (patch)
treec9b2af5f50d604406465b0e71efa5152ef22d404
parentb1665b0ec48cce7b5fd0029da92f67314eb5fa4c (diff)
downloadsltdl-c42bd5f05e744e0d863d0b10552d490377e06c63.tar.bz2
sltdl-c42bd5f05e744e0d863d0b10552d490377e06c63.tar.xz
internals: added lt_slock(), lt_sunlock().
-rw-r--r--project/headers.mk1
-rw-r--r--src/core/lt_core.c15
-rw-r--r--src/internal/sltdl_core.h7
3 files changed, 23 insertions, 0 deletions
diff --git a/project/headers.mk b/project/headers.mk
index d137b03..585234b 100644
--- a/project/headers.mk
+++ b/project/headers.mk
@@ -3,5 +3,6 @@ API_HEADERS = \
$(PROJECT_DIR)/include/$(PACKAGE)/sltdl_api.h \
INTERNAL_HEADERS = \
+ $(SOURCE_DIR)/src/internal/sltdl_core.h \
ALL_HEADERS = $(API_HEADERS) $(INTERNAL_HEADERS)
diff --git a/src/core/lt_core.c b/src/core/lt_core.c
index b0c3952..df9f58f 100644
--- a/src/core/lt_core.c
+++ b/src/core/lt_core.c
@@ -38,3 +38,18 @@ int lt_dlexit(void)
return 0;
}
+
+void lt_slock(void)
+{
+ int locked;
+
+ do {
+ locked = pthread_mutex_lock(&lt_lock);
+ } while (locked);
+}
+
+int lt_sunlock(int ret)
+{
+ pthread_mutex_unlock(&lt_lock);
+ return ret;
+}
diff --git a/src/internal/sltdl_core.h b/src/internal/sltdl_core.h
new file mode 100644
index 0000000..f74542e
--- /dev/null
+++ b/src/internal/sltdl_core.h
@@ -0,0 +1,7 @@
+#ifndef SLTDL_CORE_H
+#define SLTDL_CORE_H
+
+void lt_slock(void);
+int lt_sunlock(int);
+
+#endif