summaryrefslogtreecommitdiffstats
path: root/x11vnc/rates.c
diff options
context:
space:
mode:
Diffstat (limited to 'x11vnc/rates.c')
-rw-r--r--x11vnc/rates.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/x11vnc/rates.c b/x11vnc/rates.c
index 285b644..1424604 100644
--- a/x11vnc/rates.c
+++ b/x11vnc/rates.c
@@ -455,12 +455,17 @@ if (db) fprintf(stderr, "%d client num rects req: %d mod: %d cbs: %d "
if (OUCH && ouch_db) fprintf(stderr, "***OUCH-A\n");
if (OUCH) continue;
+ if (use_threads) LOCK(cl->updateMutex);
+
if (sraRgnCountRects(cl->modifiedRegion)) {
rfbPE(1000);
if (OUCH && ouch_db) fprintf(stderr, "***OUCH-B\n");
+ if (use_threads) UNLOCK(cl->updateMutex);
if (OUCH) continue;
}
+ if (use_threads) UNLOCK(cl->updateMutex);
+
defer = screen->deferUpdateTime;
httpdir = screen->httpDir;
screen->deferUpdateTime = 0;
@@ -486,8 +491,13 @@ if (db) fprintf(stderr, "%d client num rects req: %d mod: %d cbs: %d "
if (OUCH && ouch_db) fprintf(stderr, "***OUCH-C1\n");
if (OUCH) break;
+ if (use_threads) LOCK(cl->updateMutex);
+
req0 = sraRgnCountRects(cl->requestedRegion);
mod0 = sraRgnCountRects(cl->modifiedRegion);
+
+ if (use_threads) UNLOCK(cl->updateMutex);
+
if (use_threads) {
usleep(1000);
} else {
@@ -506,9 +516,13 @@ if (db) fprintf(stderr, "%d client num rects req: %d mod: %d cbs: %d "
if (OUCH && ouch_db) fprintf(stderr, "***OUCH-C2\n");
if (OUCH) break;
+ if (use_threads) LOCK(cl->updateMutex);
+
req1 = sraRgnCountRects(cl->requestedRegion);
mod1 = sraRgnCountRects(cl->modifiedRegion);
+ if (use_threads) UNLOCK(cl->updateMutex);
+
if (db) fprintf(stderr, "dt2 calc: num rects req: %d/%d mod: %d/%d "
"fbu-sent: %d dt: %.4f dt2: %.4f tm: %.4f\n",
req0, req1, mod0, mod1,
@@ -558,10 +572,12 @@ if (db) fprintf(stderr, "dt2 calc: num rects req: %d/%d mod: %d/%d "
while (1) {
int req0, req1, mod0, mod1;
- req0 = sraRgnCountRects(
- cl->requestedRegion);
- mod0 = sraRgnCountRects(
- cl->modifiedRegion);
+ if (use_threads) LOCK(cl->updateMutex);
+
+ req0 = sraRgnCountRects(cl->requestedRegion);
+ mod0 = sraRgnCountRects(cl->modifiedRegion);
+
+ if (use_threads) UNLOCK(cl->updateMutex);
if (i == 0) {
rfbPE(0);
@@ -582,11 +598,13 @@ if (db) fprintf(stderr, "dt2 calc: num rects req: %d/%d mod: %d/%d "
if (dt3 > spin_lat_max) {
break;
}
- req1 = sraRgnCountRects(
- cl->requestedRegion);
- mod1 = sraRgnCountRects(
- cl->modifiedRegion);
+ if (use_threads) LOCK(cl->updateMutex);
+
+ req1 = sraRgnCountRects(cl->requestedRegion);
+ mod1 = sraRgnCountRects(cl->modifiedRegion);
+
+ if (use_threads) UNLOCK(cl->updateMutex);
if (db) fprintf(stderr, "dt3 calc: num rects req: %d/%d mod: %d/%d "
"fbu-sent: %d dt: %.4f dt3: %.4f tm: %.4f\n",