summaryrefslogtreecommitdiff
path: root/pool.h
diff options
context:
space:
mode:
authorAndreas Baumann <mail@andreasbaumann.cc>2023-08-03 10:37:12 +0200
committerAndreas Baumann <mail@andreasbaumann.cc>2023-08-03 10:37:12 +0200
commitd9a54c3f6cbf068a1e1553eac9adcf9127b007f5 (patch)
treee7e8cb1beda5ae9ba83a53d0cea4a29379b6e6a6 /pool.h
parent6d6365d782a713d7fde48daa70e64e64ac283001 (diff)
downloadpgfuse-d9a54c3f6cbf068a1e1553eac9adcf9127b007f5.tar.gz
pgfuse-d9a54c3f6cbf068a1e1553eac9adcf9127b007f5.tar.bz2
fixing for platforms, where pthread_t is not numeric (as for musl, where it is a pointer,
POSIX sadly did away with the requirement that pthread_t must be a numeric): - printing thread ids as pointers with '%p' instead of converting them to unsigned int and printing them with '%u' - using separate 'avail' and 'thread' arrays in pools to record status of pooled database connections
Diffstat (limited to 'pool.h')
-rw-r--r--pool.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/pool.h b/pool.h
index c8b5036..3dbc7f7 100644
--- a/pool.h
+++ b/pool.h
@@ -27,7 +27,8 @@
typedef struct PgConnPool {
PGconn **conns; /* array of connections */
size_t size; /* max number of connections */
- pthread_t *avail; /* slots of allocated/available connections per thread */
+ unsigned int *avail; /* status of slots */
+ pthread_t *thread; /* slots of allocated/available connections per thread */
pthread_mutex_t lock; /* monitor lock */
pthread_cond_t cond; /* condition signalling a free connection */
} PgConnPool;