当前位置: 首页>>代码示例>>C++>>正文


C++ PL_UNLOCK函数代码示例

本文整理汇总了C++中PL_UNLOCK函数的典型用法代码示例。如果您正苦于以下问题:C++ PL_UNLOCK函数的具体用法?C++ PL_UNLOCK怎么用?C++ PL_UNLOCK使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了PL_UNLOCK函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: playlist_get_filename

char * playlist_get_filename(int pos)
{
    char *ret;
    PlaylistEntry *entry;
    GList *node;

    PL_LOCK();
    if (!playlist)
    {
        PL_UNLOCK();
        return NULL;
    }
    node = g_list_nth(playlist, pos);
    if (!node)
    {
        PL_UNLOCK();
        return NULL;
    }
    entry = node->data;

    ret = g_strdup(entry->filename);
    PL_UNLOCK();

    return ret;
}
开发者ID:sedwards,项目名称:xmms3,代码行数:25,代码来源:playlist.c

示例2: playlist_check_pos_current

void playlist_check_pos_current(void)
{
    int pos, row, bottom;

    PL_LOCK();
    if (!playlist || !playlist_position || !playlistwin_list)
    {
        PL_UNLOCK();
        return;
    }

    pos = g_list_index(playlist, playlist_position);

    if (playlistwin_item_visible(pos))
    {
        PL_UNLOCK();
        return;
    }

    bottom = MAX(0, __get_playlist_length() -
                 playlistwin_list->pl_num_visible);
    row = CLAMP(pos - playlistwin_list->pl_num_visible / 2, 0, bottom);
    PL_UNLOCK();
    playlistwin_set_toprow(row);
}
开发者ID:sedwards,项目名称:xmms3,代码行数:25,代码来源:playlist.c

示例3: playlist_delete_index

void playlist_delete_index(glong index)
{
    gboolean restart_playing = FALSE, set_info_text = FALSE;
    GList *node;

    PL_LOCK();
    if (!playlist)
    {
        PL_UNLOCK();
        return;
    }

    node = g_list_nth(playlist, index);
    if(!node)
    {
        PL_UNLOCK();
        return;
    }

    playlist_delete_node(node, &set_info_text, &restart_playing);

    PL_UNLOCK();

    playlistwin_update_list();
    if (restart_playing)
    {
        if (playlist_position)
            playlist_play();
        else
            mainwin_clear_song_info();
    }
    else if (set_info_text)
        mainwin_set_info_text();
}
开发者ID:sedwards,项目名称:xmms3,代码行数:34,代码来源:playlist.c

示例4: playlist_list_move_down

void playlist_list_move_down(PlayList_List *pl)
{
	GList *list;

	PL_LOCK();
	if ((list = g_list_last(get_playlist())) == NULL)
	{
		PL_UNLOCK();
		return;
	}
	if (((PlaylistEntry *) list->data)->selected)
	{
		/* We are at the bottom */
		PL_UNLOCK();
		return;
	}
	while (list)
	{
		if (((PlaylistEntry *) list->data)->selected)
			glist_movedown(list);
		list = g_list_previous(list);
	}
	PL_UNLOCK();
	if (pl->pl_prev_selected != -1)
		pl->pl_prev_selected++;
	if (pl->pl_prev_min != -1)
		pl->pl_prev_min++;
	if (pl->pl_prev_max != -1)
		pl->pl_prev_max++;
}
开发者ID:sedwards,项目名称:xmms3,代码行数:30,代码来源:playlist_list.c

示例5: playlist_list_move_up

void playlist_list_move_up(PlayList_List *pl)
{
	GList *list;

	PL_LOCK();
	if ((list = get_playlist()) == NULL)
	{
		PL_UNLOCK();
		return;
	}
	if (((PlaylistEntry *) list->data)->selected)
	{
		/* We are at the top */
		PL_UNLOCK();
		return;
	}
	while (list)
	{
		if (((PlaylistEntry *) list->data)->selected)
			glist_moveup(list);
		list = g_list_next(list);
	}
	PL_UNLOCK();
	if (pl->pl_prev_selected != -1)
		pl->pl_prev_selected--;
	if (pl->pl_prev_min != -1)
		pl->pl_prev_min--;
	if (pl->pl_prev_max != -1)
		pl->pl_prev_max--;
}
开发者ID:sedwards,项目名称:xmms3,代码行数:30,代码来源:playlist_list.c

示例6: playlist_get_songtime

int playlist_get_songtime(int pos)
{
    int retval = -1;
    PlaylistEntry *entry;
    GList *node;

    PL_LOCK();
    if (!playlist)
    {
        PL_UNLOCK();
        return -1;
    }
    node = g_list_nth(playlist, pos);
    if (!node)
    {
        PL_UNLOCK();
        return -1;
    }
    entry = node->data;

    if (entry->title == NULL && entry->length == -1)
    {
        if (playlist_get_info_entry(entry))
            retval = entry->length;

        PL_UNLOCK();
    }
    else
    {
        retval = entry->length;
        PL_UNLOCK();
    }

    return retval;
}
开发者ID:sedwards,项目名称:xmms3,代码行数:35,代码来源:playlist.c

示例7: PL_LOCK

char *playlist_get_info_text(void)
{
    char *text, *tmp, *numbers, *length;
    const gchar *title;

    PL_LOCK();
    if (!playlist_position)
    {
        PL_UNLOCK();
        return NULL;
    }

    if (playlist_position->title)
        title = playlist_position->title;
    else
        title = xmms_g_basename(playlist_position->filename);

    /*
     * If the user don't want numbers in the playlist, don't
     * display them in other parts of XMMS
     */

    if (cfg.show_numbers_in_pl)
        numbers = g_strdup_printf("%d. ", __get_playlist_position() + 1);
    else
        numbers = g_strdup("");

    if (playlist_position->length != -1)
        length = g_strdup_printf(" (%d:%-2.2d)",
                                 playlist_position->length / 60000,
                                 (playlist_position->length / 1000) % 60);
    else
        length = g_strdup("");

    text = g_strdup_printf("%s%s%s", numbers, title, length);
    g_free(numbers);
    g_free(length);

    PL_UNLOCK();

    if (cfg.convert_underscore)
        while ((tmp = strchr(text, '_')) != NULL)
            *tmp = ' ';
    if (cfg.convert_twenty)
        while ((tmp = strstr(text, "%20")) != NULL)
        {
            char *tmp2;
            tmp2 = tmp + 3;
            *(tmp++) = ' ';
            while (*tmp2)
                *(tmp++) = *(tmp2++);
            *tmp = '\0';
        }

    return text;
}
开发者ID:sedwards,项目名称:xmms3,代码行数:56,代码来源:playlist.c

示例8: playlist_prev

void playlist_prev(void)
{
    GList *plist_pos_list;
    gboolean restart_playing = FALSE;

    PL_LOCK();
    if (!playlist)
    {
        PL_UNLOCK();
        return;
    }

    plist_pos_list = find_playlist_position_list();

    if (!cfg.repeat && !g_list_previous(plist_pos_list))
    {
        PL_UNLOCK();
        return;
    }

    if (get_input_playing())
    {
        /* We need to stop before changing playlist_position */
        PL_UNLOCK();
        input_stop();
        PL_LOCK();
        restart_playing = TRUE;
    }

    plist_pos_list = find_playlist_position_list();
    if (g_list_previous(plist_pos_list))
        playlist_position = plist_pos_list->prev->data;
    else if (cfg.repeat)
    {
        GList *node;
        playlist_position = NULL;
        __playlist_generate_shuffle_list();
        if (cfg.shuffle)
            node = g_list_last(shuffle_list);
        else
            node = g_list_last(playlist);
        if (node)
            playlist_position = node->data;
    }
    PL_UNLOCK();
    playlist_check_pos_current();

    if (restart_playing)
        playlist_play();
    else
    {
        mainwin_set_info_text();
        playlistwin_update_list();
    }
}
开发者ID:sedwards,项目名称:xmms3,代码行数:55,代码来源:playlist.c

示例9: destroySourceFile

int
destroySourceFile(SourceFile sf)
{ DEBUG(MSG_SRCFILE,
	Sdprintf("Destroying source file %s\n", PL_atom_chars(sf->name)));

  clearSourceAdmin(sf);

  PL_LOCK(L_SRCFILE);
  if ( sf->magic == SF_MAGIC )
  { SourceFile f;

    sf->magic = SF_MAGIC_DESTROYING;
    f = deleteHTable(GD->files.table, (void*)sf->name);
    assert(f);
    PL_unregister_atom(sf->name);
    putSourceFileArray(sf->index, NULL);
    if ( GD->files.no_hole_before > sf->index )
      GD->files.no_hole_before = sf->index;
  }
  PL_UNLOCK(L_SRCFILE);

  unallocSourceFile(sf);

  return TRUE;
}
开发者ID:SWI-Prolog,项目名称:swipl-devel,代码行数:25,代码来源:pl-srcfile.c

示例10: playlist_get_total_time

void playlist_get_total_time(gulong *total_time, gulong *selection_time, gboolean *total_more, gboolean *selection_more)
{
    GList *list;
    PlaylistEntry *entry;

    *total_time = 0;
    *selection_time = 0;
    *total_more = FALSE;
    *selection_more = FALSE;

    PL_LOCK();
    list = get_playlist();
    while (list)
    {
        entry = list->data;
        if (entry->length != -1)
            *total_time += entry->length / 1000;
        else
            *total_more = TRUE;
        if (entry->selected)
        {
            if (entry->length != -1)
                *selection_time += entry->length / 1000;
            else
                *selection_more = TRUE;
        }
        list = g_list_next(list);
    }
    PL_UNLOCK();
}
开发者ID:sedwards,项目名称:xmms3,代码行数:30,代码来源:playlist.c

示例11: PL_register_blob_type

void
PL_register_blob_type(PL_blob_t *type)
{ PL_LOCK(L_MISC);			/* cannot use L_ATOM */

  if ( !type->registered )
  { if ( !GD->atoms.types )
    { GD->atoms.types = type;
    } else
    { PL_blob_t *t = GD->atoms.types;

      while(t->next)
	t = t->next;

      t->next = type;
      type->rank = t->rank+1;
    }
    type->registered = TRUE;
    if ( !type->atom_name )
      type->atom_name = PL_new_atom(type->name);

    if ( true(type, PL_BLOB_TEXT) )
    { if ( true(type, PL_BLOB_WCHAR) )
	type->padding = sizeof(pl_wchar_t);
      else
	type->padding = sizeof(char);
    }
  }

  PL_UNLOCK(L_MISC);
}
开发者ID:bsmr-swi-prolog,项目名称:swipl,代码行数:30,代码来源:pl-atom.c

示例12: playlist_set_shuffle

void playlist_set_shuffle(gboolean shuffle)
{
    PL_LOCK();
    cfg.shuffle = shuffle;
    __playlist_generate_shuffle_list();
    PL_UNLOCK();
}
开发者ID:sedwards,项目名称:xmms3,代码行数:7,代码来源:playlist.c

示例13: playlist_delete

void playlist_delete(gboolean crop)
{
    gboolean restart_playing = FALSE, set_info_text = FALSE;
    GList *node, *next;
    PlaylistEntry *entry;

    PL_LOCK();

    node = playlist;

    while (node)
    {
        entry = node->data;
        next = g_list_next(node);
        if ((entry->selected && !crop) || (!entry->selected && crop))
            playlist_delete_node(node, &set_info_text, &restart_playing);
        node = next;
    }
    PL_UNLOCK();

    playlistwin_update_list();
    if (restart_playing)
    {
        if (playlist_position)
            playlist_play();
        else
            mainwin_clear_song_info();
    }
    else if (set_info_text)
        mainwin_set_info_text();
}
开发者ID:sedwards,项目名称:xmms3,代码行数:31,代码来源:playlist.c

示例14: playlist_delete_filenames

void playlist_delete_filenames(GList *filenames)
{
    GList *node, *fnode;
    gboolean set_info_text = FALSE, restart_playing = FALSE;

    PL_LOCK();
    for (fnode = filenames; fnode; fnode = g_list_next(fnode))
    {
        node = playlist;
        while (node)
        {
            GList *next = g_list_next(node);
            PlaylistEntry *entry = node->data;
            if (!strcmp(entry->filename, fnode->data))
                playlist_delete_node(node, &set_info_text,
                                     &restart_playing);
            node = next;
        }
    }

    PL_UNLOCK();

    playlistwin_update_list();
    if (restart_playing)
    {
        if (playlist_position)
            playlist_play();
        else
            mainwin_clear_song_info();
    }
    else if (set_info_text)
        mainwin_set_info_text();
}
开发者ID:sedwards,项目名称:xmms3,代码行数:33,代码来源:playlist.c

示例15: playlist_read_info_selection

gboolean playlist_read_info_selection(void)
{
    GList *node;
    gboolean retval = FALSE;

    PL_LOCK();
    for (node = get_playlist(); node; node = node->next)
    {
        PlaylistEntry *entry = node->data;
        if (entry->selected)
        {
            retval = TRUE;
            if (entry->title)
                g_free(entry->title);
            entry->title = NULL;
            entry->length = -1;
            if (!playlist_get_info_entry(entry))
            {
                if (g_list_index(get_playlist(), entry) == -1)
                    /* Entry disapeared while we
                       looked it up.  Restart. */
                    node = get_playlist();
            }
        }
    }
    PL_UNLOCK();
    playlistwin_update_list();
    return retval;
}
开发者ID:sedwards,项目名称:xmms3,代码行数:29,代码来源:playlist.c


注:本文中的PL_UNLOCK函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。