1
0
mirror of https://github.com/Tha14/toxic.git synced 2024-11-27 02:03:26 +01:00

file sender thread was a failed experiment - do_file_senders should only be called once per tox_do iteration

This commit is contained in:
Jfreegman 2014-06-30 02:40:58 -04:00
parent a194f7ad87
commit 7ae807002e
3 changed files with 3 additions and 29 deletions

View File

@ -196,6 +196,8 @@ void cmd_clear(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[M
{ {
line_info_clear(self->chatwin->hst); line_info_clear(self->chatwin->hst);
wclear(window); wclear(window);
endwin();
refresh();
} }
void cmd_connect(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE]) void cmd_connect(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])

View File

@ -84,7 +84,6 @@ struct arg_opts {
} arg_opts; } arg_opts;
struct _Winthread Winthread; struct _Winthread Winthread;
struct _FSenderThread FSenderThread;
struct user_settings *user_settings = NULL; struct user_settings *user_settings = NULL;
@ -463,10 +462,8 @@ static void load_data(Tox *m, char *path)
static void do_toxic(Tox *m, ToxWindow *prompt) static void do_toxic(Tox *m, ToxWindow *prompt)
{ {
pthread_mutex_lock(&Winthread.lock);
do_connection(m, prompt); do_connection(m, prompt);
pthread_mutex_unlock(&Winthread.lock); do_file_senders(m);
tox_do(m); /* main tox-core loop */ tox_do(m); /* main tox-core loop */
} }
@ -480,19 +477,6 @@ void *thread_winref(void *data)
} }
} }
void *thread_filesenders(void *data)
{
Tox *m = (Tox *) data;
while (true) {
pthread_mutex_lock(&FSenderThread.lock);
do_file_senders(m);
pthread_mutex_unlock(&FSenderThread.lock);
usleep(60000);
}
}
static void print_usage(void) static void print_usage(void)
{ {
fprintf(stderr, "usage: toxic [OPTION] [FILE ...]\n"); fprintf(stderr, "usage: toxic [OPTION] [FILE ...]\n");
@ -623,13 +607,6 @@ int main(int argc, char *argv[])
if (pthread_create(&Winthread.tid, NULL, thread_winref, (void *) m) != 0) if (pthread_create(&Winthread.tid, NULL, thread_winref, (void *) m) != 0)
exit_toxic_err("failed in main", FATALERR_THREAD_CREATE); exit_toxic_err("failed in main", FATALERR_THREAD_CREATE);
/* thread for filesenders */
if (pthread_mutex_init(&FSenderThread.lock, NULL) != 0)
exit_toxic_err("failed in main", FATALERR_MUTEX_INIT);
if (pthread_create(&FSenderThread.tid, NULL, thread_filesenders, (void *) m) != 0)
exit_toxic_err("failed in main", FATALERR_THREAD_CREATE);
uint8_t *msg; uint8_t *msg;
#ifdef _SUPPORT_AUDIO #ifdef _SUPPORT_AUDIO

View File

@ -67,11 +67,6 @@ struct _Winthread {
pthread_mutex_t lock; pthread_mutex_t lock;
}; };
struct _FSenderThread {
pthread_t tid;
pthread_mutex_t lock;
};
typedef struct ToxWindow ToxWindow; typedef struct ToxWindow ToxWindow;
typedef struct StatusBar StatusBar; typedef struct StatusBar StatusBar;
typedef struct PromptBuf PromptBuf; typedef struct PromptBuf PromptBuf;