- int i_ret;
- vlc_object_internals_t *p_priv = vlc_internals( p_this );
-
- struct vlc_thread_boot *boot = malloc (sizeof (*boot));
- if (boot == NULL)
- return errno;
- boot->entry = func;
- boot->object = p_this;
-
- /* Make sure we don't re-create a thread if the object has already one */
- assert( !p_priv->b_thread );
-
- p_priv->b_thread = true;
- i_ret = vlc_clone( &p_priv->thread_id, thread_entry, boot, i_priority );
- if( i_ret == 0 )
- msg_Dbg( p_this, "thread (%s) created at priority %d (%s:%d)",
- psz_name, i_priority, psz_file, i_line );
- else
- {
- p_priv->b_thread = false;
- errno = i_ret;
- msg_Err( p_this, "%s thread could not be created at %s:%d (%m)",
- psz_name, psz_file, i_line );
- }
-
- return i_ret;