summaryrefslogtreecommitdiff
path: root/rts
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2015-11-26 12:02:47 +0100
committerBen Gamari <ben@smart-cactus.org>2015-11-26 14:48:50 +0100
commit1712a9ed333dfa2fc9ce7d55acab08a8d278fb5b (patch)
treea38c4a337f1ae365cc82b3993fa4ef816a0d71da /rts
parentc4308b468c7fe723b6f0a1009b233a55260de503 (diff)
downloadhaskell-1712a9ed333dfa2fc9ce7d55acab08a8d278fb5b.tar.gz
LibdwPool: Use poolTryTake
Diffstat (limited to 'rts')
-rw-r--r--rts/LibdwPool.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/rts/LibdwPool.c b/rts/LibdwPool.c
index f625c0f699..b0de8ac7c3 100644
--- a/rts/LibdwPool.c
+++ b/rts/LibdwPool.c
@@ -16,6 +16,23 @@
#include "Pool.h"
+/*
+ * Note [libdw session pool]
+ * ~~~~~~~~~~~~~~~~~~~~~~~~~
+ *
+ * Building a libdw session requires a number of rather expensive steps,
+ *
+ * - Examine the object files mapped into the address space
+ * - Find them on disk
+ * - Open them and map their debugging information
+ * - Build various index structures necessary for quick lookup
+ *
+ * The time to setup a session can be several milliseconds. In order to avoid
+ * incurring this cost too often, we keep a pool of warm sessions around which
+ * can be shared between capabilities.
+ *
+ */
+
static Pool *pool = NULL;
static nat pool_size = 10; // TODO
@@ -26,7 +43,7 @@ void libdwPoolInit(void) {
}
LibdwSession *libdwPoolTake(void) {
- return poolTake(pool);
+ return poolTryTake(pool);
}
void libdwPoolRelease(LibdwSession *sess) {