Added some check for B_INTERRUPTED in semaphores acquisitions. Could fix bug #89, although I can't reproduce it in Qemu
git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@16338 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1460,7 +1460,8 @@ ChartWindow::ChangeSetting(setting new_set)
|
|||||||
}
|
}
|
||||||
if (new_set.display == DISPLAY_DIRECT) {
|
if (new_set.display == DISPLAY_DIRECT) {
|
||||||
/* this need to be atomic in regard of DirectConnected */
|
/* this need to be atomic in regard of DirectConnected */
|
||||||
acquire_sem(fDrawingLock);
|
while (acquire_sem(fDrawingLock) == B_INTERRUPTED)
|
||||||
|
;
|
||||||
/* synchronise the camera geometry and the direct buffer geometry */
|
/* synchronise the camera geometry and the direct buffer geometry */
|
||||||
SetGeometry(direct_buffer.buffer_width, direct_buffer.buffer_height);
|
SetGeometry(direct_buffer.buffer_width, direct_buffer.buffer_height);
|
||||||
/* cancel erasing of stars not in visible part of the direct window */
|
/* cancel erasing of stars not in visible part of the direct window */
|
||||||
@@ -1514,7 +1515,8 @@ ChartWindow::ChangeSetting(setting new_set)
|
|||||||
/* update all dependencies in the offscreen buffer descriptor */
|
/* update all dependencies in the offscreen buffer descriptor */
|
||||||
SetColorSpace(&bitmap_buffer, bitmap_buffer.depth);
|
SetColorSpace(&bitmap_buffer, bitmap_buffer.depth);
|
||||||
/* update all dependencies in the directwindow buffer descriptor */
|
/* update all dependencies in the directwindow buffer descriptor */
|
||||||
acquire_sem(fDrawingLock);
|
while (acquire_sem(fDrawingLock) == B_INTERRUPTED)
|
||||||
|
;
|
||||||
SetColorSpace(&direct_buffer, direct_buffer.depth);
|
SetColorSpace(&direct_buffer, direct_buffer.depth);
|
||||||
release_sem(fDrawingLock);
|
release_sem(fDrawingLock);
|
||||||
/* in offscreen mode, erase the background and cancel star erasing */
|
/* in offscreen mode, erase the background and cancel star erasing */
|
||||||
@@ -2139,7 +2141,8 @@ ChartWindow::Animation(void *data)
|
|||||||
directbuffer context won't change during the drawing
|
directbuffer context won't change during the drawing
|
||||||
operations. During that period, no Window should be
|
operations. During that period, no Window should be
|
||||||
done to avoid any potential deadlock. */
|
done to avoid any potential deadlock. */
|
||||||
acquire_sem(w->fDrawingLock);
|
while (acquire_sem(w->fDrawingLock) == B_INTERRUPTED)
|
||||||
|
;
|
||||||
if (w->fDirectConnected)
|
if (w->fDirectConnected)
|
||||||
w->RefreshStars(&w->direct_buffer, time_factor * 2.4);
|
w->RefreshStars(&w->direct_buffer, time_factor * 2.4);
|
||||||
release_sem(w->fDrawingLock);
|
release_sem(w->fDrawingLock);
|
||||||
@@ -2213,7 +2216,11 @@ ChartWindow::Animation2(void *data)
|
|||||||
/* This thread need to both wait for its master to unblock
|
/* This thread need to both wait for its master to unblock
|
||||||
him to do some real work, or for the main control to
|
him to do some real work, or for the main control to
|
||||||
set the fKillThread flag, asking it to quit. */
|
set the fKillThread flag, asking it to quit. */
|
||||||
while (acquire_sem_etc(w->second_thread_lock, 1, B_TIMEOUT, 500000) == B_TIMED_OUT)
|
status_t status;
|
||||||
|
do {
|
||||||
|
status = acquire_sem_etc(w->second_thread_lock, 1, B_TIMEOUT, 500000);
|
||||||
|
|
||||||
|
} while (status == B_TIMED_OUT || status == B_INTERRUPTED);
|
||||||
if (w->fKillThread)
|
if (w->fKillThread)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
@@ -2757,7 +2764,8 @@ ChartWindow::RefreshStars(buffer *buf, float time_step)
|
|||||||
after = system_time();
|
after = system_time();
|
||||||
|
|
||||||
/* wait for completion of the second thread */
|
/* wait for completion of the second thread */
|
||||||
acquire_sem(second_thread_release);
|
while (acquire_sem(second_thread_release) == B_INTERRUPTED)
|
||||||
|
;
|
||||||
|
|
||||||
/* calculate the new optimal split ratio depending
|
/* calculate the new optimal split ratio depending
|
||||||
of the previous one and the time used by both
|
of the previous one and the time used by both
|
||||||
@@ -2879,7 +2887,8 @@ void
|
|||||||
ChartWindow::DirectConnected(direct_buffer_info *info)
|
ChartWindow::DirectConnected(direct_buffer_info *info)
|
||||||
{
|
{
|
||||||
/* block the animation thread. */
|
/* block the animation thread. */
|
||||||
acquire_sem(fDrawingLock);
|
while (acquire_sem(fDrawingLock) == B_INTERRUPTED)
|
||||||
|
;
|
||||||
/* update the direct screen infos. */
|
/* update the direct screen infos. */
|
||||||
SwitchContext(info);
|
SwitchContext(info);
|
||||||
/* unblock the animation thread. */
|
/* unblock the animation thread. */
|
||||||
|
|||||||
Reference in New Issue
Block a user