diff options
author | Sverker Eriksson <[email protected]> | 2018-03-12 11:50:42 +0100 |
---|---|---|
committer | Sverker Eriksson <[email protected]> | 2018-05-08 14:38:41 +0200 |
commit | 3ab4ac0371b8646246c8b029dd89f39c3a6981b4 (patch) | |
tree | 2a1f87590829ec2a82d16f6afe2d604f0e8fa300 /erts/emulator/beam/erl_db_util.h | |
parent | c26bfdd48c8deabe9cc0f67badb0d8a95a641845 (diff) | |
download | otp-3ab4ac0371b8646246c8b029dd89f39c3a6981b4.tar.gz otp-3ab4ac0371b8646246c8b029dd89f39c3a6981b4.tar.bz2 otp-3ab4ac0371b8646246c8b029dd89f39c3a6981b4.zip |
erts: Make atomic ets:delete_all_objects yield
by using a cooperative strategy that will make
any process accessing the table execute delelete_all_objects_continue
until the table is empty.
This is not an optimal solution as concurrent threads will still
block on the table lock, but at least thread progress is made.
Diffstat (limited to 'erts/emulator/beam/erl_db_util.h')
-rw-r--r-- | erts/emulator/beam/erl_db_util.h | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/erts/emulator/beam/erl_db_util.h b/erts/emulator/beam/erl_db_util.h index 6b126f35d6..db8dfa5be4 100644 --- a/erts/emulator/beam/erl_db_util.h +++ b/erts/emulator/beam/erl_db_util.h @@ -32,6 +32,7 @@ ** DMC_DEBUG does NOT need DEBUG, but DEBUG needs DMC_DEBUG */ #define DMC_DEBUG 1 +#define ETS_DBG_FORCE_TRAP 1 #endif /* @@ -180,8 +181,7 @@ typedef struct db_table_method Eterm* ret); int (*db_take)(Process *, DbTable *, Eterm, Eterm *); - int (*db_delete_all_objects)(Process* p, - DbTable* db /* [in out] */ ); + SWord (*db_delete_all_objects)(Process* p, DbTable* db, SWord reds); int (*db_free_table)(DbTable* db /* [in out] */ ); SWord (*db_free_table_continue)(DbTable* db, SWord reds); @@ -267,6 +267,10 @@ typedef struct db_table_common { Uint32 status; /* bit masks defined below */ int keypos; /* defaults to 1 */ int compress; + +#ifdef ETS_DBG_FORCE_TRAP + erts_atomic_t dbg_force_trap; /* &1 force enabled, &2 trap this call */ +#endif } DbTableCommon; /* These are status bit patterns */ @@ -281,9 +285,7 @@ typedef struct db_table_common { #define DB_FINE_LOCKED (1 << 8) /* write_concurrency */ #define DB_FREQ_READ (1 << 9) /* read_concurrency */ #define DB_NAMED_TABLE (1 << 10) - -#define ERTS_ETS_TABLE_TYPES (DB_BAG|DB_SET|DB_DUPLICATE_BAG|DB_ORDERED_SET\ - |DB_FINE_LOCKED|DB_FREQ_READ|DB_NAMED_TABLE) +#define DB_BUSY (1 << 11) #define IS_HASH_TABLE(Status) (!!((Status) & \ (DB_BAG | DB_SET | DB_DUPLICATE_BAG))) |