~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to drizzled/atomics.h

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
58
58
 
59
59
  atomic_impl() : atomic_base<I>(), traits() {}
60
60
 
 
61
  value_type add_and_fetch( D addend )
 
62
  {
 
63
    return traits.add_and_fetch(&this->my_value, addend);
 
64
  }
 
65
 
61
66
  value_type fetch_and_add( D addend )
62
67
  {
63
68
    return traits.fetch_and_add(&this->my_value, addend);
78
83
    return traits.fetch_and_store(&this->my_value, value);
79
84
  }
80
85
 
81
 
  value_type compare_and_swap( value_type value, value_type comparand )
 
86
  bool compare_and_swap( value_type value, value_type comparand )
82
87
  {
83
88
    return traits.compare_and_swap(&this->my_value, value, comparand);
84
89
  }
102
107
public:
103
108
  atomic_impl<I,D,T>& operator+=( D addend )
104
109
  {
105
 
    fetch_and_add(addend)+addend;
 
110
    increment(addend);
106
111
    return *this;
107
112
  }
108
113
 
113
118
    return operator+=(D(0)-addend);
114
119
  }
115
120
 
116
 
  value_type increment() {
117
 
    return fetch_and_add(1)+1;
118
 
  }
119
 
 
120
 
  value_type decrement() {
121
 
    return fetch_and_add(D(-1))-1;
122
 
  }
123
 
 
124
 
 
 
121
  value_type increment()
 
122
  {
 
123
    return add_and_fetch(1);
 
124
  }
 
125
 
 
126
  value_type decrement()
 
127
  {
 
128
    return add_and_fetch(D(-1));
 
129
  }
125
130
};
126
131
 
127
132
} /* namespace internal */