1directfb: Fix for hangs in direct_test, fusion_skirmish on exit
2
3Upstream-Status: Pending
4Signed-off-by: Lauren Post <lauren.post@freescale.com>
5
6--- a/lib/fusion/fusion.c	2013-01-18 22:57:11.000000000 +0800
7+++ b/lib/fusion/fusion.c	2013-07-04 10:42:56.502699119 +0800
8@@ -2853,9 +2853,14 @@
9           direct_mutex_lock( &world->event_dispatcher_mutex );
10
11           while (1) {
12-               if (!world->event_dispatcher_buffers)
13+               if (!world->event_dispatcher_buffers){
14                     direct_waitqueue_wait( &world->event_dispatcher_cond, &world->event_dispatcher_mutex );
15-
16+                    if (world->dispatch_stop) {
17+                         D_DEBUG_AT( Fusion_Main_Dispatch, "  -> IGNORING (dispatch_stop!)\n" );
18+                         direct_mutex_unlock( &world->event_dispatcher_mutex );
19+                         return NULL;
20+                    }
21+               }
22                buf = (FusionEventDispatcherBuffer *)world->event_dispatcher_buffers;
23                D_MAGIC_ASSERT( buf, FusionEventDispatcherBuffer );
24
25@@ -2872,6 +2877,11 @@
26 //D_INFO("waiting...\n");
27                     D_ASSERT( buf->read_pos == buf->write_pos );
28                     direct_waitqueue_wait( &world->event_dispatcher_cond, &world->event_dispatcher_mutex );
29+		      if (world->dispatch_stop) {
30+                         D_DEBUG_AT( Fusion_Main_Dispatch, "  -> IGNORING (dispatch_stop!)\n" );
31+                         direct_mutex_unlock( &world->event_dispatcher_mutex );
32+                         return NULL;
33+                    }
34                }
35
36                buf = (FusionEventDispatcherBuffer *)world->event_dispatcher_buffers;
37