Beispiel #1
0
DirectResult
fusion_ref_throw (FusionRef *ref, FusionID catcher)
{
     FusionRefThrow throw_;

     D_ASSERT( ref != NULL );

     if (ref->multi.id == fusion_config->trace_ref) {
          D_INFO( "Fusion/Ref: 0x%08x throw\n", ref->multi.id );
          direct_trace_print_stack( NULL );
     }

     throw_.id      = ref->multi.id;
     throw_.catcher = catcher;

     while (ioctl (_fusion_fd( ref->multi.shared ), FUSION_REF_THROW, &throw_)) {
          switch (errno) {
               case EINTR:
                    continue;
               case EINVAL:
                    D_ERROR ("Fusion/Reference: invalid reference\n");
                    return DR_DESTROYED;
               default:
                    break;
          }

          D_PERROR ("FUSION_REF_THROW");

          return DR_FAILURE;
     }

     return DR_OK;
}
Beispiel #2
0
DirectResult
fusion_ref_catch (FusionRef *ref)
{
     D_ASSERT( ref != NULL );

     if (ref->multi.id == fusion_config->trace_ref) {
          D_INFO( "Fusion/Ref: 0x%08x catch\n", ref->multi.id );
          direct_trace_print_stack( NULL );
     }

     while (ioctl (_fusion_fd( ref->multi.shared ), FUSION_REF_CATCH, &ref->multi.id)) {
          switch (errno) {
               case EINTR:
                    continue;
               case EINVAL:
                    D_ERROR ("Fusion/Reference: invalid reference\n");
                    return DR_DESTROYED;
               default:
                    break;
          }

          D_PERROR ("FUSION_REF_CATCH");

          return DR_FAILURE;
     }

     return DR_OK;
}
Beispiel #3
0
DirectResult
fusion_ref_down (FusionRef *ref, bool global)
{
     D_ASSERT( ref != NULL );

     D_DEBUG_AT( Fusion_Ref, "fusion_ref_down( %p [%d]%s )\n", ref, ref->multi.id, global ? " GLOBAL" : "" );

     if (ref->multi.id == fusion_config->trace_ref) {
          D_INFO( "Fusion/Ref: 0x%08x down (%s)\n", ref->multi.id, global ? "global" : "local" );
          direct_trace_print_stack( NULL );
     }

     fusion_world_flush_calls( _fusion_world( ref->multi.shared ), 1 );

     while (ioctl (_fusion_fd( ref->multi.shared ), global ?
                   FUSION_REF_DOWN_GLOBAL : FUSION_REF_DOWN, &ref->multi.id))
     {
          switch (errno) {
               case EINTR:
                    continue;
               case EINVAL:
                    D_ERROR ("Fusion/Reference: invalid reference\n");
                    return DR_DESTROYED;
               default:
                    break;
          }

          if (global)
               D_PERROR ("FUSION_REF_DOWN_GLOBAL");
          else
               D_PERROR ("FUSION_REF_DOWN");

          return DR_FAILURE;
     }

// FIMXE: the following had to be commented out as the ref down may cause a ref watcher to free the memory of 'ref' (via ioctl)
#if 0
     if (ref->multi.shared)
          D_DEBUG_AT( Fusion_Ref, "  -> %d references now\n",
                      ioctl( _fusion_fd( ref->multi.shared ), FUSION_REF_STAT, &ref->multi.id ) );
     else
          D_DEBUG_AT( Fusion_Ref, "  -> destroyed\n" );
#endif

     return DR_OK;
}
Beispiel #4
0
MMSThread::MMSThread(string identity, int priority, bool autodetach) {
#ifdef __HAVE_DIRECTFB__
    D_DEBUG_AT( MMS_Thread, "MMSThread( %s )\n", identity.c_str() );

    direct_trace_print_stack(NULL);
#endif /* __HAVE_DIRECTFB__ */

    // save parameters
    this->identity = identity;
    this->priority = priority;

    // setup initial values
    this->starting = false;
    this->running = false;
    this->detached = false;
    this->autodetach = autodetach;
    setStacksize();
}
Beispiel #5
0
static bool
local_alloc_hash_iterator( DirectHash    *hash,
                           unsigned long  key,
                           void          *value,
                           void          *ctx )
{
     MemDesc       *desc  = value;
     unsigned long *total = ctx;

     direct_log_printf( NULL, ""_ZUn(7)" bytes at %p allocated in %s (%s: %u)\n",
                        desc->bytes, desc->mem, desc->func, desc->file, desc->line );

     if (desc->trace)
          direct_trace_print_stack( desc->trace );

     *total += desc->bytes;

     return true;
}
Beispiel #6
0
DirectResult
fusion_ref_up (FusionRef *ref, bool global)
{
     D_ASSERT( ref != NULL );

     D_DEBUG_AT( Fusion_Ref, "fusion_ref_up( %p [%d]%s )\n", ref, ref->multi.id, global ? " GLOBAL" : "" );

     if (ref->multi.id == fusion_config->trace_ref) {
          D_INFO( "Fusion/Ref: 0x%08x up (%s)\n", ref->multi.id, global ? "global" : "local" );
          direct_trace_print_stack( NULL );
     }

     while (ioctl (_fusion_fd( ref->multi.shared ), global ?
                   FUSION_REF_UP_GLOBAL : FUSION_REF_UP, &ref->multi.id))
     {
          switch (errno) {
               case EINTR:
                    continue;
               case EAGAIN:
                    return DR_LOCKED;
               case EINVAL:
                    D_ERROR ("Fusion/Reference: invalid reference\n");
                    return DR_DESTROYED;
               default:
                    break;
          }

          if (global)
               D_PERROR ("FUSION_REF_UP_GLOBAL");
          else
               D_PERROR ("FUSION_REF_UP");

          return DR_FAILURE;
     }

     D_DEBUG_AT( Fusion_Ref, "  -> %d references now\n",
                 ioctl( _fusion_fd( ref->multi.shared ), FUSION_REF_STAT, &ref->multi.id ) );

     return DR_OK;
}