diff options
author | Dan Gudmundsson <[email protected]> | 2016-05-11 10:02:48 +0200 |
---|---|---|
committer | Dan Gudmundsson <[email protected]> | 2016-05-11 11:52:58 +0200 |
commit | 5c3d447c95d55c9c7da2dd69569549992e3fd741 (patch) | |
tree | cd60621d10f0a667897aa050aa6a6f69d75259a0 /lib/wx | |
parent | 8420cbc23f2f2d26e235bcff3fbd94e688bb34f8 (diff) | |
download | otp-5c3d447c95d55c9c7da2dd69569549992e3fd741.tar.gz otp-5c3d447c95d55c9c7da2dd69569549992e3fd741.tar.bz2 otp-5c3d447c95d55c9c7da2dd69569549992e3fd741.zip |
wx: Fix driver command queue
The command queue could still loose a cmd because the command was
reused while still in (recursive) use, thus when deleting it after
command was done a newly added command could be mistakenly deleted and
not called.
Root cause was that wxeFifo::Strip "deleted" to many cmds.
Solve by differing deleted and executed, i.e. op= -1 cmd have been
executed and op = -2 cmd have been executed and deleted.
Diffstat (limited to 'lib/wx')
-rw-r--r-- | lib/wx/c_src/wxe_helpers.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/wx/c_src/wxe_helpers.cpp b/lib/wx/c_src/wxe_helpers.cpp index 4798e605e8..d1f607d2af 100644 --- a/lib/wx/c_src/wxe_helpers.cpp +++ b/lib/wx/c_src/wxe_helpers.cpp @@ -48,7 +48,7 @@ void wxeCommand::Delete() driver_free(buffer); buffer = NULL; } - op = -1; + op = -2; } /* **************************************************************************** @@ -84,7 +84,7 @@ wxeCommand * wxeFifo::Get() pos = m_first++; m_n--; m_first %= m_max; - } while(m_q[pos].op == -1); + } while(m_q[pos].op < 0); return &m_q[pos]; } @@ -96,7 +96,7 @@ wxeCommand * wxeFifo::Peek(unsigned int *i) return NULL; pos = (m_first+*i) % m_max; (*i)++; - } while(m_q[pos].op == -1); + } while(m_q[pos].op < 0); return &m_q[pos]; } @@ -213,7 +213,7 @@ void wxeFifo::Realloc() // Strip end of queue if ops are already taken care of, avoids reallocs void wxeFifo::Strip() { - while((m_n > 0) && (m_q[(m_first + m_n - 1)%m_max].op == -1)) { + while((m_n > 0) && (m_q[(m_first + m_n - 1)%m_max].op < -1)) { m_n--; } } |