summaryrefslogtreecommitdiff
path: root/storage/perfschema/pfs_lock.h
diff options
context:
space:
mode:
Diffstat (limited to 'storage/perfschema/pfs_lock.h')
-rw-r--r--storage/perfschema/pfs_lock.h14
1 files changed, 13 insertions, 1 deletions
diff --git a/storage/perfschema/pfs_lock.h b/storage/perfschema/pfs_lock.h
index 09efecd1c5f..be84d0f7fb4 100644
--- a/storage/perfschema/pfs_lock.h
+++ b/storage/perfschema/pfs_lock.h
@@ -1,4 +1,4 @@
-/* Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved.
+/* Copyright (c) 2009, 2016, Oracle and/or its affiliates. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -156,6 +156,18 @@ struct pfs_lock
}
/**
+ Initialize a lock to dirty.
+ */
+ void set_dirty(void)
+ {
+ /* Do not set the version to 0, read the previous value. */
+ uint32 copy= PFS_atomic::load_u32(&m_version_state);
+ /* Increment the version, set the DIRTY state */
+ uint32 new_val= (copy & VERSION_MASK) + VERSION_INC + PFS_LOCK_DIRTY;
+ PFS_atomic::store_u32(&m_version_state, new_val);
+ }
+
+ /**
Execute a dirty to free transition.
This transition should be executed by the writer that owns the record.
*/