예제 #1
0
파일: input_hub.c 프로젝트: kuii/dfbNEON
DFBResult
CoreInputHub_Create( u32            queue_id,
                     CoreInputHub **ret_hub )
{
     DFBResult     ret;
     CoreInputHub *hub;

     D_DEBUG_AT( Core_InputHub, "%s()\n", __FUNCTION__ );

     D_ASSERT( ret_hub != NULL );

     ret = One_Initialize();
     if (ret)
          return ret;

     hub = D_CALLOC( 1, sizeof(CoreInputHub) );
     if (!hub)
          return D_OOM();

     direct_mutex_init( &hub->lock );

     ret = OneQueue_New( ONE_QUEUE_NO_FLAGS, queue_id, &hub->method_qid );
     if (ret)
          goto error;

     ret = OneQueue_New( ONE_QUEUE_VIRTUAL, ONE_QID_NONE, &hub->notify_qid );
     if (ret)
          goto error;

     ret = OneThread_Create( "Input Hub", &hub->thread );
     if (ret)
          goto error;

     ret = OneThread_AddQueue( hub->thread, hub->method_qid, CoreInputHub_Dispatch, hub );
     if (ret)
          goto error;

     D_INFO( "Core/Input/Hub: Running at QID %u\n", hub->method_qid );

     *ret_hub = hub;

     return DFB_OK;


error:
     if (hub->thread)
          OneThread_Destroy( hub->thread );

     if (hub->notify_qid)
          OneQueue_Destroy( hub->notify_qid );

     if (hub->method_qid)
          OneQueue_Destroy( hub->method_qid );

     direct_mutex_deinit( &hub->lock );

     D_FREE( hub );

     return ret;
}
예제 #2
0
DFBResult
CoreInputHubClient_Destroy( CoreInputHubClient *client )
{
     D_DEBUG_AT( Core_InputHub, "%s()\n", __FUNCTION__ );

     OneThread_Destroy( client->thread );

     OneQueue_Destroy( client->listen_qid );

     if (client->activate_thread) {
          direct_mutex_lock( &client->lock );

          client->activate_stop = true;

          direct_waitqueue_broadcast( &client->wq );

          direct_mutex_unlock( &client->lock );


          direct_thread_join( client->activate_thread );
          direct_thread_destroy( client->activate_thread );
     }

     direct_mutex_deinit( &client->lock );
     direct_waitqueue_deinit( &client->wq );

     D_FREE( client );

     return DFB_OK;
}
예제 #3
0
int
main( int argc, char *argv[] )
{
    DirectResult ret;

    if (parse_cmdline( argc, argv ))
        return -1;

    direct_mutex_init( &lock );
    direct_waitqueue_init( &queue );

    ret = One_Initialize();
    if (ret)
        return ret;

    ret = OneThread_Create( "OneTest", &thread );
    if (ret)
        return ret;

    ret = OneQueue_New( ONE_QUEUE_NO_FLAGS, queue_id, &queue_id );
    if (ret)
        return ret;

    D_INFO( "Queue ID %u\n", queue_id );

    TestWakeUp();

    direct_mutex_deinit( &lock );
    direct_waitqueue_deinit( &queue );

    return 0;
}
예제 #4
0
파일: signals.c 프로젝트: kuii/dfbNEON
DirectResult
direct_signals_shutdown( void )
{
     D_DEBUG_AT( Direct_Signals, "Shutting down...\n" );

     remove_handlers();

     direct_mutex_deinit( &handlers_lock );

     return DR_OK;
}
예제 #5
0
static void
IDirectFBDataBuffer_File_Destruct( IDirectFBDataBuffer *thiz )
{
     IDirectFBDataBuffer_File_data *data =
          (IDirectFBDataBuffer_File_data*) thiz->priv;

     direct_stream_destroy( data->stream );

     direct_mutex_deinit( &data->mutex );

     IDirectFBDataBuffer_Destruct( thiz );
}
예제 #6
0
static void
IComaComponent_One_Destruct( IComaComponent *thiz )
{
     int                      i;
     IComaComponent_One_data *data = thiz->priv;

     D_DEBUG( "%s (%p)\n", __FUNCTION__, thiz );

     /* If method_func is non-NULL, we're the creator */
     if (data->method_func) {
          if (data->dispatch_thread) {
               data->dispatch_stop = true;

               OneQueue_WakeUp( &data->method_qid, 1 );

               direct_thread_join( data->dispatch_thread );
               direct_thread_destroy( data->dispatch_thread );
          }

          OneQueue_Destroy( data->method_qid );

          for (i=0; i<data->num_notifications; i--)
               OneQueue_Destroy( data->notifications[i].qid );
     }


     data->notify_stop = true;

     OneQueue_WakeUp( &data->notify_qid, 1 );

     if (data->notify_thread) {
          direct_thread_join( data->notify_thread );
          direct_thread_destroy( data->notify_thread );
     }

     OneQueue_Destroy( data->notify_qid );


     direct_hash_iterate( data->calls, call_iterator, data );
     direct_hash_destroy( data->calls );
     direct_mutex_deinit( &data->calls_lock );

     if (data->notifications)
          D_FREE( data->notifications );

     if (data->listeners)
          D_FREE( data->listeners );

     One_Shutdown();

     DIRECT_DEALLOCATE_INTERFACE( thiz );
}
예제 #7
0
DirectResult
fusion_ref_destroy (FusionRef *ref)
{
     D_ASSERT( ref != NULL );

     ref->single.destroyed = true;

     direct_waitqueue_broadcast (&ref->single.cond);

     direct_mutex_deinit( &ref->single.lock );
     direct_waitqueue_deinit( &ref->single.cond );

     return DR_OK;
}
예제 #8
0
static void
Close( VoodooLink *link )
{
     Link *l = link->priv;

     D_INFO( "Voodoo/Link: Closing connection.\n" );

     // FIXME: how to close socket?

     direct_mutex_deinit( &l->lock );

     WSACloseEvent( l->event );

     D_FREE( l );
}
예제 #9
0
static DFBResult
dfb_colorhash_core_leave( DFBColorHashCore *data,
                          bool              emergency )
{
     D_DEBUG_AT( Core_ColorHash, "dfb_colorhash_core_leave( %p, %semergency )\n", data, emergency ? "" : "no " );

     D_MAGIC_ASSERT( data, DFBColorHashCore );
     D_MAGIC_ASSERT( data->shared, DFBColorHashCoreShared );

     direct_mutex_deinit( &data->hash_lock );

     D_FREE( data->hash );

     D_MAGIC_CLEAR( data );

     return DFB_OK;
}
예제 #10
0
파일: input_hub.c 프로젝트: kuii/dfbNEON
DFBResult
CoreInputHub_Destroy( CoreInputHub *hub )
{
     D_DEBUG_AT( Core_InputHub, "%s()\n", __FUNCTION__ );

     D_ASSERT( hub != NULL );

     OneThread_Destroy( hub->thread );

     OneQueue_Destroy( hub->notify_qid );

     OneQueue_Destroy( hub->method_qid );

     direct_mutex_deinit( &hub->lock );

     D_FREE( hub );

     return DFB_OK;
}
예제 #11
0
DirectResult
direct_processor_destroy( DirectProcessor *processor )
{
     void *item;

     D_MAGIC_ASSERT( processor, DirectProcessor );

     D_DEBUG_AT( Direct_Processor, "%s( %p '%s' )\n", __FUNCTION__, processor, processor->name );

     processor->stop = true;

     direct_thread_terminate( processor->thread );

     direct_fifo_wakeup( &processor->commands );
     direct_fifo_wakeup( &processor->recycled );

     direct_thread_join( processor->thread );
     direct_thread_destroy( processor->thread );


     while ((item = direct_fifo_pull( &processor->commands )) != NULL)
          D_FREE( item );
          
     direct_fifo_destroy( &processor->commands );


     while ((item = direct_fifo_pull( &processor->recycled )) != NULL)
          D_FREE( item );

     direct_fifo_destroy( &processor->recycled );


#if 0
     direct_waitqueue_deinit( &processor->lock_cond );
     direct_mutex_deinit( &processor->lock_mutex );
#endif

     D_FREE( processor->name );

     D_MAGIC_CLEAR( processor );

     return DR_OK;
}
예제 #12
0
파일: perf.c 프로젝트: Distrotech/DirectFB
void
__D_perf_deinit()
{
     if (counter_dump_thread) {
          DirectThread *thread = counter_dump_thread;

          direct_thread_lock( thread );
          counter_dump_thread = NULL;
          direct_thread_notify( thread );
          direct_thread_unlock( thread );

          direct_thread_join( thread );
          direct_thread_destroy( thread );
     }

     //direct_perf_dump_all();

     direct_hash_deinit( &counter_hash );
     direct_mutex_deinit( &counter_lock );
}
예제 #13
0
DirectResult
direct_signals_shutdown( void )
{
     D_DEBUG_AT( Direct_Signals, "Shutting down...\n" );
#ifdef ANDROID_NDK
     remove_handlers();
#else
     if (direct_config->sighandler_thread) {
          if (sighandler_thread) {
               direct_thread_kill( sighandler_thread, SIG_CLOSE_SIGHANDLER );
               direct_thread_join( sighandler_thread );
               direct_thread_destroy( sighandler_thread );
               sighandler_thread = NULL;
          }
     }
     else
          remove_handlers();
#endif
     direct_mutex_deinit( &handlers_lock );

     return DR_OK;
}
예제 #14
0
VoodooConnectionLink::~VoodooConnectionLink()
{
     D_DEBUG_AT( Voodoo_Connection, "VoodooConnectionLink::%s( %p )\n", __func__, this );

     D_MAGIC_ASSERT( this, VoodooConnection );

     /* Acquire locks and wake up waiters. */
     direct_mutex_lock( &output.lock );
     direct_waitqueue_broadcast( &output.wait );
     direct_mutex_unlock( &output.lock );

     /* Destroy conditions. */
     direct_waitqueue_deinit( &output.wait );

     /* Destroy locks. */
     direct_mutex_deinit( &output.lock );

     /* Deallocate buffers. */
     D_FREE( input.buffer );

     direct_tls_unregister( &output.tls );
}
예제 #15
0
파일: dispatcher.cpp 프로젝트: kuii/dfbNEON
VoodooDispatcher::~VoodooDispatcher()
{
     D_DEBUG_AT( Voodoo_Dispatcher, "VoodooDispatcher::%s( %p )\n", __func__, this );

     D_MAGIC_ASSERT( this, VoodooDispatcher );

     /* Acquire lock and wake up waiters. */
     direct_mutex_lock( &lock );
     direct_waitqueue_broadcast( &queue );
     direct_mutex_unlock( &lock );

     /* Wait for dispatcher loop exiting. */
     direct_thread_join( dispatch_loop );
     direct_thread_destroy( dispatch_loop );

     /* Destroy queue. */
     direct_waitqueue_deinit( &queue );

     /* Destroy lock. */
     direct_mutex_deinit( &lock );

     D_MAGIC_CLEAR( this );
}
예제 #16
0
파일: interface.c 프로젝트: kuii/dfbNEON
void
__D_interface_deinit()
{
    direct_mutex_deinit( &implementations_mutex );
}
예제 #17
0
파일: log_domain.c 프로젝트: kuii/dfbNEON
void
__D_log_domain_deinit()
{
     direct_mutex_deinit( &domains_lock );
}
예제 #18
0
int
main( int argc, char *argv[] )
{
    DirectResult  ret;
    IFusionDale  *dale;
    int           i;

    //dfb_config_init( &argc, &argv );

    ret = FusionDaleInit( &argc, &argv );
    if (ret) {
        D_DERROR( ret, "FusionDaleInit() failed!\n" );
        return -1;
    }

    ret = FusionDaleCreate( &dale );
    if (ret) {
        D_DERROR( ret, "FusionDaleCreate() failed!\n" );
        return -2;
    }

    ret = dale->EnterComa( dale, "Coma Test", &coma );
    if (ret) {
        D_DERROR( ret, "IFusionDale::EnterComa('Coma Test') failed!\n" );
        return -3;
    }

    direct_mutex_init( &decoupled_calls_lock );
    direct_waitqueue_init( &decoupled_calls_wq );

    for (i=1; i<argc; i++) {
        if (strncmp( argv[i], "create", 6 ) == 0) {
            int n, num;
            int threads = 1;

            if (sscanf( argv[i]+6, "%d,%d", &num, &threads ) >= 1) {
                for (n=0; n<num; n++) {
                    RUN_create( n );
                }

                for (n=0; n<threads; n++) {
                    direct_thread_create( DTT_DEFAULT, DecoupledCall_thread_main, NULL, "Process" );
                }

                pause();
            }
            else
                fprintf( stderr, "Wrong number '%s'!\n", argv[i]+6 );
        }
        else if (strncmp( argv[i], "call", 4 ) == 0) {
            int index, threads = 1;

            if (sscanf( argv[i]+4, "%d,%d", &index, &threads ) >= 1) {
                RUN_call_threaded( index, threads );
            }
            else
                fprintf( stderr, "Wrong number '%s'!\n", argv[i]+4 );
        }
    }

    direct_waitqueue_deinit( &decoupled_calls_wq );
    direct_mutex_deinit( &decoupled_calls_lock );

    coma->Release( coma );

    dale->Release( dale );

    return 0;
}
 ~ClientList()
 {
      direct_mutex_deinit( &lock );
 }
예제 #20
0
void
__D_mem_deinit()
{
     direct_mutex_deinit( &alloc_lock );
}
예제 #21
0
파일: result.c 프로젝트: kuii/dfbNEON
void
__D_result_deinit()
{
     direct_mutex_deinit( &result_mutex );
}