[vlc-devel] [PATCH 1/9] playlist: assign unique id to playlist items

Romain Vimont rom1v at videolabs.io
Mon Mar 4 15:28:27 CET 2019


On Mon, Mar 04, 2019 at 04:07:40PM +0200, Rémi Denis-Courmont wrote:
> We also had assertions before. That did not prevent horrors along the line of lock/get/unlock ... lock/use/unlock.
> 
> In other words an assertion is not enough. We'd need a way to invalidate the item after unlocking.

The id is just a uint64_t, and it typically survives lock/unlock blocks.

The typical scenario is to retrieve the id when we have the real item
(e.g. to send the playlist content to the HTTP client):

    lock()
    item = Get(index)
    id = GetId(item)
    // ...
    unlock()

then later, retrieve the real item from the id (e.g. if the HTTP client
requests to do something with the item):

    lock()
    index = IndexOfId(id)
    if index != -1 {
        item = Get(index)
        // ...
    }
    unlock()

> -- 
> Envoyé de mon appareil Android avec Courriel K-9 Mail. Veuillez excuser ma brièveté.

> _______________________________________________
> vlc-devel mailing list
> To unsubscribe or modify your subscription options:
> https://mailman.videolan.org/listinfo/vlc-devel



More information about the vlc-devel mailing list