Files
The Transactional Data-Structures Module

The txlib module provides data structures that are safe to use from within transactions and cooperate with the transaction manager. Currently supported are lists, queues, multisets and stacks. More...

Files

file  picotm-txlib.h
 Provides transactional data structures.
 
file  picotm-txlist-state.h
 Provides non-transactional state and entries for transactional lists.
 
file  picotm-txlist.h
 Provides transactional lists.
 
file  picotm-txmultiset-state.h
 Provides non-transactional state and entries for transactional multisets.
 
file  picotm-txmultiset.h
 Provides transactional multisets.
 
file  picotm-txqueue-state.h
 Provides non-transactional state and entries for transactional queues.
 
file  picotm-txqueue.h
 Provides transactional queues.
 
file  picotm-txstack-state.h
 Provides non-transactional state and entries for transactional stacks.
 
file  picotm-txstack.h
 Provides transactional stacks.
 

Detailed Description

Txlib, the transactional data-structures module, provides data structures that are safe and efficient to use from within transactions. Each data strcuture's implementation cooperates with the transaction manager to provide concurrency control and error recovery.

As a quick example, the following code removes an entry from a source list and appends it to a destination list. The change becomes globally visible during the transaction's successful commit. Concurrent, conflicting access to the list data strcutures is detected and resolved automatically. If the transaction has to roll back at any point, the invoked operation are reverted and the lists return to their previous state.

struct txlist_state src_list_state = TXLIST_STATE_INITIALIZER(src_list_state);
struct txlist_state dst_list_state = TXLIST_STATE_INITIALIZER(dst_list_state);
// init code
struct txlist* src_list = txlist_of_state_tx(&src_list_state);
struct txlist* dst_list = txlist_of_state_tx(&dst_list_state);
// The list state for 'src_list' already contains the entry.
txlist_erase_tx(src_list, &list_entry);
txlist_push_back_tx(dst_list, &item->list_entry);
// ... more transactional code ...

For more information, refer to the documentation of the specific data structure.

  1. Transactional Lists
    The transactional list provides a transaction-safe implementation of a double-linked list. Efficient insert and remove operations are supported anywhere within the list.
  2. Transactional Queues
    The transactional queue provides a transaction-safe implementation of a single-ended FIFO queue. Efficient insert operations are supported on one end, efficient remove operations are supported on the opposite end.
  3. Transactional Multisets
    The transactional multiset provides a transaction-safe implementation of a multiset. Multisets are sorted sets of elements. Duplicate entries are supported.
  4. Transactional Stacks
    The transactional stack provides a transaction-safe implementation of a single-ended LIFO stack. Efficient insert and remove operations are supported on the same end.