예제 #1
0
DirectResult
voodoo_manager_destroy( VoodooManager *manager )
{
     D_MAGIC_ASSERT( manager, VoodooManager );

     D_DEBUG( "Voodoo/Manager: Destroying manager at %p!\n", manager );

     if (!manager->quit)
          voodoo_manager_quit( manager );

     /* Wait for manager threads exiting. */
     direct_thread_join( manager->input.thread );
     direct_thread_destroy( manager->input.thread );

     direct_thread_join( manager->dispatcher );
     direct_thread_destroy( manager->dispatcher );

     direct_thread_join( manager->output.thread );
     direct_thread_destroy( manager->output.thread );

     /* Destroy conditions. */
     pthread_cond_destroy( &manager->input.wait );
     pthread_cond_destroy( &manager->response.wait );
     pthread_cond_destroy( &manager->output.wait );

     /* Destroy locks. */
     pthread_mutex_destroy( &manager->instances.lock );
     pthread_mutex_destroy( &manager->input.lock );
     pthread_mutex_destroy( &manager->response.lock );
     pthread_mutex_destroy( &manager->output.lock );

     /* Release all remaining interfaces. */
     direct_hash_iterate( manager->instances.local, instance_iterator, (void*) false );
     direct_hash_iterate( manager->instances.local, instance_iterator, (void*) true );
     direct_hash_destroy( manager->instances.local );

     direct_hash_destroy( manager->instances.remote );

     D_MAGIC_CLEAR( manager );

     /* Deallocate manager structure. */
     D_FREE( manager );

     return DR_OK;
}
예제 #2
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 );
}
예제 #3
0
파일: perf.c 프로젝트: Distrotech/DirectFB
void
direct_perf_dump_all()
{
     direct_mutex_lock( &counter_lock );

     if (direct_hash_count( &counter_hash )) {
          direct_log_printf( NULL, "Performance Counters                                               Total count    rate           start        end\n" );

          direct_hash_iterate( &counter_hash, perf_iterate, NULL );
     }

     direct_mutex_unlock( &counter_lock );
}
예제 #4
0
void
direct_print_memleaks( void )
{
     unsigned long total = 0;

     /* Debug only. */
     direct_mutex_lock( &alloc_lock );

     if (alloc_hash.count) {
          direct_log_printf( NULL, "Local memory allocations remaining (%d): \n", alloc_hash.count );

          direct_hash_iterate( &alloc_hash, local_alloc_hash_iterator, &total );
     }

     direct_mutex_unlock( &alloc_lock );

     if (total)
          direct_log_printf( NULL, "%7lu bytes in total\n", total );
}