[pypy-commit] stmgc c8-adaptive-trx-length: Merge number of segments in use function
tobweber
pypy.commits at gmail.com
Tue May 2 10:34:24 EDT 2017
Author: Tobias Weber <tobias_weber89 at gmx.de>
Branch: c8-adaptive-trx-length
Changeset: r2046:439c2a69589d
Date: 2017-04-29 12:02 +0200
http://bitbucket.org/pypy/stmgc/changeset/439c2a69589d/
Log: Merge number of segments in use function
diff --git a/c8/stm/sync.c b/c8/stm/sync.c
--- a/c8/stm/sync.c
+++ b/c8/stm/sync.c
@@ -176,6 +176,16 @@
/************************************************************/
+static uint8_t number_of_segments_in_use(void) {
+ uint8_t result = 0;
+ int num;
+ for (num = 1; num < NB_SEGMENTS; num++) {
+ if (sync_ctl.in_use1[num] > 0) {
+ result++;
+ }
+ }
+ return result;
+}
#if 0
void stm_wait_for_current_inevitable_transaction(void)
@@ -202,7 +212,6 @@
}
#endif
-
static void acquire_thread_segment(stm_thread_local_t *tl)
{
/* This function acquires a segment for the currently running thread,
diff --git a/c8/stm/sync.h b/c8/stm/sync.h
--- a/c8/stm/sync.h
+++ b/c8/stm/sync.h
@@ -22,6 +22,7 @@
static void set_gs_register(char *value);
static void ensure_gs_register(long segnum);
+static uint8_t number_of_segments_in_use(void);
/* acquire and release one of the segments for running the given thread
(must have the mutex acquired!) */
More information about the pypy-commit
mailing list