Right!

I have been trying to figure out what is going on in vlc for quite
some time. Im going to post my findings before I stop for the day.

On Sun, Mar 28, 2010 at 7:46 PM, Edd Barrett <vex...@gmail.com> wrote:
> Hi,
>
> On Thu, Mar 25, 2010 at 12:05:56AM +0000, Edd Barrett wrote:
>> On Wed, Mar 24, 2010 at 11:41:41PM +0300, Kirill Bychkov wrote:
>> > > I thought I'd try this on amd64, but it doesn't do anything.
>> > > When I run "vlc", nothing happens.  It prints its little
>> > > "VLC media player 1.0.5 Goldeneye" banner, and that's it.
>> > > No window comes up or anything.
>> >
>> > I've seen the same behaviour on amd64
>>
>> Thats what i was getting on sparc64.

The hotkeys plugin is waiting for a thread. The line of code which we
never get past is this:

vlc_cond_wait (p_condvar=0x40cfa148, p_mutex=0xfffffffffffffffe) at
misc/threads.c:584
584         int val = pthread_cond_wait( p_condvar, p_mutex );

And this is how we got there:
#0  vlc_cond_wait (p_condvar=0x40cfa148, p_mutex=0xfffffffffffffffe)
at misc/threads.c:584
#1  0x000000007e981bd4 in GetAction (p_intf=0x40cfa140) at hotkeys.c:903
#2  0x000000007e97fa9c in Run (p_intf=0x4077dd78) at hotkeys.c:178
#3  0x00000000476b0270 in RunInterface (p_this=0x4077dd78) at
interface/interface.c:218
#4  0x0000000047711e18 in thread_entry (data=0x47711800) at misc/threads.c:1093
#5  0x0000000048976cf8 in _thread_start ()
    at /usr/src/lib/libpthread/uthread/uthread_create.c:241
#6  0x0000000048976cc0 in pthread_create (thread=0x0, attr=0x0,
start_routine=0, arg=0x0)
    at /usr/src/lib/libpthread/uthread/uthread_create.c:230


vlc_cond_wait is just a portability wrapper around threading
implementations. For us this means it just calls pthread_cond_wait().
So I guess we need to look here:

static int GetAction( intf_thread_t *p_intf )
{
    intf_sys_t *p_sys = p_intf->p_sys;
    int i_ret;

    vlc_mutex_lock( &p_sys->lock );
    mutex_cleanup_push( &p_sys->lock );

    while( p_sys->i_size == 0 )
        vlc_cond_wait( &p_sys->wait, &p_sys->lock ); /* <----------- STUCK */

    i_ret = p_sys->p_actions[ 0 ];
    p_sys->i_size--;
    for( int i = 0; i < p_sys->i_size; i++ )
        p_sys->p_actions[i] = p_sys->p_actions[i + 1];

    vlc_cleanup_run();
    return i_ret;
}

Comments and ideas are welcomed! I must admit I am not familiar with
this API. Can anyone see anything obvious?

PS.

If you want to try this for yourself, note that most of vlc is dlopen()ed ;)

-- 
Best Regards
Edd Barrett

http://www.theunixzoo.co.uk

Reply via email to