-
Notifications
You must be signed in to change notification settings - Fork 20.8k
Closed
Labels
Description
public boolean writeToCharBuffer(char c) {
boolean result = false;
// if we can write to the buffer
if (_readable_data.get() < _buffer_size) {
// write to buffer
_buffer[getTrueIndex(_write_index)] = c;
_readable_data.incrementAndGet();
_write_index++;
result = true;
}
return result;
}
thread 1 and thread 2 execute "_buffer[getTrueIndex(_write_index)] = c;" At the same time,the result is not definite.
How about this issue? Or I missed this code.