45 |
45 |
46 template <typename Operation> |
46 template <typename Operation> |
47 inline bool ConcurrentWriteOp<Operation>::process(typename Operation::Type* t) { |
47 inline bool ConcurrentWriteOp<Operation>::process(typename Operation::Type* t) { |
48 const u1* const current_top = t->concurrent_top(); |
48 const u1* const current_top = t->concurrent_top(); |
49 const size_t unflushed_size = t->pos() - current_top; |
49 const size_t unflushed_size = t->pos() - current_top; |
50 if (unflushed_size == 0 || t->excluded()) { |
50 if (unflushed_size == 0) { |
51 t->set_concurrent_top(current_top); |
51 t->set_concurrent_top(current_top); |
52 return true; |
52 return true; |
53 } |
53 } |
54 const bool result = _operation.write(t, current_top, unflushed_size); |
54 const bool result = _operation.write(t, current_top, unflushed_size); |
55 t->set_concurrent_top(current_top + unflushed_size); |
55 t->set_concurrent_top(current_top + unflushed_size); |
56 return result; |
56 return result; |
57 } |
57 } |
58 |
58 |
59 template <typename Operation> |
59 template <typename Operation> |
60 inline bool ConcurrentWriteOpExcludeRetired<Operation>::process(typename Operation::Type* t) { |
60 inline bool ConcurrentWriteOpExcludeRetired<Operation>::process(typename Operation::Type* t) { |
61 if (t->retired()) { |
61 if (t->retired() || t->excluded()) { |
62 assert(t->empty(), "invariant"); |
|
63 return true; |
62 return true; |
64 } |
63 } |
65 return ConcurrentWriteOp<Operation>::process(t); |
64 return ConcurrentWriteOp<Operation>::process(t); |
66 } |
65 } |
67 |
66 |
68 template <typename Operation> |
67 template <typename Operation> |
69 inline bool MutexedWriteOp<Operation>::process(typename Operation::Type* t) { |
68 inline bool MutexedWriteOp<Operation>::process(typename Operation::Type* t) { |
70 assert(t != NULL, "invariant"); |
69 assert(t != NULL, "invariant"); |
71 const u1* const current_top = t->top(); |
70 const u1* const current_top = t->top(); |
72 const size_t unflushed_size = t->pos() - current_top; |
71 const size_t unflushed_size = t->pos() - current_top; |
73 if (unflushed_size == 0 || t->excluded()) { |
72 if (unflushed_size == 0) { |
74 return true; |
73 return true; |
75 } |
74 } |
76 const bool result = _operation.write(t, current_top, unflushed_size); |
75 const bool result = _operation.write(t, current_top, unflushed_size); |
77 t->set_top(current_top + unflushed_size); |
76 t->set_top(current_top + unflushed_size); |
78 return result; |
77 return result; |