+void *ui_thread_function (void *attr)
+{
+ WINDOW *main_win, *playlists_win;
+
+ if ((main_win = initscr()) == NULL) {
+ fprintf(stderr, "Error initializing ncurses.\n");
+ exit(4);
+ }
+ fprintf(stderr, "DEBUG: UI started, ncurses initialized.\n");
+
+ cbreak();
+ noecho();
+ keypad(main_win, TRUE);
+
+ playlists_win = subwin(main_win, LINES - 2, COLS, 2, 0);
+ box(playlists_win, 0, 0);
+
+ int i;
+
+ i = 0;
+ pthread_mutex_lock(&ui_mutex);
+ while (1) {
+ while (!show_ui)
+ pthread_cond_wait(&ui_cond, &ui_mutex);
+
+ pthread_mutex_unlock(&ui_mutex);
+
+ mvwprintw(playlists_win, i + 2, 2, "LOLLLOL");
+
+ wrefresh(playlists_win);
+
+ getch();
+
+ ++i;
+ pthread_mutex_lock(&ui_mutex);
+ }
+
+ delwin(playlists_win);
+ delwin(main_win);
+ endwin();
+
+ finish(0);
+}
+
+void start_ui_thread (void)
+{
+ int ui_thread_id;
+ pthread_t ui_thread;
+
+ ui_thread_id = pthread_create(
+ &ui_thread,
+ NULL,
+ &ui_thread_function,
+ NULL);
+}
+