Beispiel #1
0
int pthread_spin_destroy( pthread_spinlock_t *spinlock )
{
#if defined(RTEMS_SMP) && defined(POSIX_SPINLOCKS_ARE_SELF_CONTAINED)
  POSIX_Spinlock_Control *the_spinlock;

  the_spinlock = _POSIX_Spinlock_Get( spinlock );
  _SMP_ticket_lock_Destroy( &the_spinlock->Lock );
#endif
  return 0;
}
Beispiel #2
0
static void _Thread_Free( Thread_Control *the_thread )
{
  Thread_Information *information = (Thread_Information *)
    _Objects_Get_information_id( the_thread->Object.id );

  _User_extensions_Thread_delete( the_thread );

  /*
   * Free the per-thread scheduling information.
   */
  _Scheduler_Node_destroy( _Scheduler_Get( the_thread ), the_thread );

  /*
   *  The thread might have been FP.  So deal with that.
   */
#if ( CPU_HARDWARE_FP == TRUE ) || ( CPU_SOFTWARE_FP == TRUE )
#if ( CPU_USE_DEFERRED_FP_SWITCH == TRUE )
  if ( _Thread_Is_allocated_fp( the_thread ) )
    _Thread_Deallocate_fp();
#endif

  _Workspace_Free( the_thread->Start.fp_context );
#endif

  _Freechain_Put(
    &information->Free_thread_queue_heads,
    the_thread->Wait.spare_heads
  );

  /*
   *  Free the rest of the memory associated with this task
   *  and set the associated pointers to NULL for safety.
   */
  _Thread_Stack_Free( the_thread );

  _Workspace_Free( the_thread->Start.tls_area );

#if defined(RTEMS_SMP)
  _SMP_ticket_lock_Destroy( &the_thread->Lock.Default );
  _SMP_lock_Stats_destroy( &the_thread->Lock.Stats );
  _SMP_lock_Stats_destroy( &the_thread->Potpourri_stats );
#endif

  _Objects_Free( &information->Objects, &the_thread->Object );
}