diff options
-rw-r--r-- | apps/buffering.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/apps/buffering.c b/apps/buffering.c index 2d7ca22368..64f522c52f 100644 --- a/apps/buffering.c +++ b/apps/buffering.c | |||
@@ -177,6 +177,8 @@ enum { | |||
177 | Q_SET_WATERMARK, | 177 | Q_SET_WATERMARK, |
178 | Q_START_FILL, /* Request that the buffering thread initiate a buffer | 178 | Q_START_FILL, /* Request that the buffering thread initiate a buffer |
179 | fill at its earliest convenience */ | 179 | fill at its earliest convenience */ |
180 | Q_HANDLE_ADDED, /* Inform the buffering thread that a handle was added, | ||
181 | (which means the disk is spinning) */ | ||
180 | }; | 182 | }; |
181 | 183 | ||
182 | /* Buffering thread */ | 184 | /* Buffering thread */ |
@@ -936,6 +938,10 @@ int bufopen(const char *file, size_t offset, enum data_type type) | |||
936 | /* Other types will get buffered in the course of normal operations */ | 938 | /* Other types will get buffered in the course of normal operations */ |
937 | h->fd = -1; | 939 | h->fd = -1; |
938 | close(fd); | 940 | close(fd); |
941 | |||
942 | /* Inform the buffering thread that we added a handle */ | ||
943 | LOGFQUEUE("buffering > Q_HANDLE_ADDED %d", h->id); | ||
944 | queue_post(&buffering_queue, Q_HANDLE_ADDED, h->id); | ||
939 | } | 945 | } |
940 | 946 | ||
941 | logf("bufopen: new hdl %d", h->id); | 947 | logf("bufopen: new hdl %d", h->id); |
@@ -1358,6 +1364,12 @@ void buffering_thread(void) | |||
1358 | queue_reply(&buffering_queue, close_handle((int)ev.data)); | 1364 | queue_reply(&buffering_queue, close_handle((int)ev.data)); |
1359 | break; | 1365 | break; |
1360 | 1366 | ||
1367 | case Q_HANDLE_ADDED: | ||
1368 | LOGFQUEUE("buffering < Q_HANDLE_ADDED %d", (int)ev.data); | ||
1369 | /* A handle was added: the disk is spinning, so we can fill */ | ||
1370 | filling = true; | ||
1371 | break; | ||
1372 | |||
1361 | case Q_BASE_HANDLE: | 1373 | case Q_BASE_HANDLE: |
1362 | LOGFQUEUE("buffering < Q_BASE_HANDLE"); | 1374 | LOGFQUEUE("buffering < Q_BASE_HANDLE"); |
1363 | base_handle_id = (int)ev.data; | 1375 | base_handle_id = (int)ev.data; |