aboutsummaryrefslogblamecommitdiffstats
path: root/lib/dialyzer/test/race_tests_SUITE_data/src/mnesia_dirty_read_two_write_one.erl
blob: 515e9f11dec02c91ab3a585b9ef4f0b60a9d3d6c (plain) (tree)





















                                                                           
%% This tests the presence of possible races due to an mnesia:dirty_read/
%% mnesia:dirty_write combination. It takes into account the argument types
%% of the calls.

-module(mnesia_dirty_read_two_write_one).
-export([raise/2]).

-record(employee, {emp_no,
                   name,
                   salary,
                   sex,
                   phone,
                   room_no}).


raise(Eno, Raise) ->
    [E] = mnesia:dirty_read(employee, Eno),
    Salary = E#employee.salary + Raise,
    New = E#employee{salary = Salary},
    mnesia:dirty_write(New).