コード例 #1
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;
}
コード例 #2
0
ファイル: input_hub.c プロジェクト: Distrotech/DirectFB
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
ファイル: ref.c プロジェクト: lelou6666/DirectFB-1.6.3-ab
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;
}
コード例 #4
0
ファイル: processor.c プロジェクト: Distrotech/DirectFB
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;
}
コード例 #5
0
ファイル: connection_link.cpp プロジェクト: kuii/dfbNEON
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 );
}
コード例 #6
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 );
}
コード例 #7
0
ファイル: coma_test.c プロジェクト: lihp1603/DirectFB
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;
}