aboutsummaryrefslogtreecommitdiffstats
path: root/lib/wx/c_src/wxe_impl.cpp
diff options
context:
space:
mode:
authorDan Gudmundsson <[email protected]>2017-04-26 16:07:24 +0200
committerDan Gudmundsson <[email protected]>2017-04-28 09:51:32 +0200
commit9ab3802aa7d8d04ec8cad00d45b405dddcddd3c9 (patch)
treec0b72bbe9fc14e05edc59dc447940505e4ffd6e7 /lib/wx/c_src/wxe_impl.cpp
parentb1df6219d51a56cb934d91225af9d8f78931c3ce (diff)
downloadotp-9ab3802aa7d8d04ec8cad00d45b405dddcddd3c9.tar.gz
otp-9ab3802aa7d8d04ec8cad00d45b405dddcddd3c9.tar.bz2
otp-9ab3802aa7d8d04ec8cad00d45b405dddcddd3c9.zip
Fixup batch break
Batches was breaked to often, increase the test and break if batch is done (and queue empty).
Diffstat (limited to 'lib/wx/c_src/wxe_impl.cpp')
-rw-r--r--lib/wx/c_src/wxe_impl.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/wx/c_src/wxe_impl.cpp b/lib/wx/c_src/wxe_impl.cpp
index 05d56667ab..8d92fb1f9b 100644
--- a/lib/wx/c_src/wxe_impl.cpp
+++ b/lib/wx/c_src/wxe_impl.cpp
@@ -267,6 +267,8 @@ int WxeApp::dispatch_cmds()
return more;
}
+#define BREAK_BATCH 200
+
int WxeApp::dispatch(wxeFifo * batch)
{
int ping = 0;
@@ -279,7 +281,11 @@ int WxeApp::dispatch(wxeFifo * batch)
erl_drv_mutex_unlock(wxe_batch_locker_m);
switch(event->op) {
case WXE_BATCH_END:
- if(blevel>0) blevel--;
+ if(blevel>0) {
+ blevel--;
+ if(blevel==0)
+ wait += BREAK_BATCH*100;
+ }
break;
case WXE_BATCH_BEGIN:
blevel++;
@@ -311,10 +317,13 @@ int WxeApp::dispatch(wxeFifo * batch)
erl_drv_mutex_lock(wxe_batch_locker_m);
batch->Cleanup();
}
- if(blevel <= 0 || wait > 3) {
+ if(blevel <= 0 || wait > BREAK_BATCH) {
erl_drv_mutex_unlock(wxe_batch_locker_m);
- if(blevel > 0) return 1; // We are still in a batch but we can let wx check for events
- else return 0;
+ if(blevel > 0) {
+ return 1; // We are still in a batch but we can let wx check for events
+ } else {
+ return 0;
+ }
}
// sleep until something happens
// fprintf(stderr, "%s:%d sleep %d %d %d\r\n", __FILE__, __LINE__, batch->m_n, blevel, wait);fflush(stderr);