mirror of
https://github.com/Tha14/toxic.git
synced 2024-12-23 14:53: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:
parent
a194f7ad87
commit
7ae807002e
@ -196,6 +196,8 @@ void cmd_clear(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[M
|
||||
{
|
||||
line_info_clear(self->chatwin->hst);
|
||||
wclear(window);
|
||||
endwin();
|
||||
refresh();
|
||||
}
|
||||
|
||||
void cmd_connect(WINDOW *window, ToxWindow *self, Tox *m, int argc, char (*argv)[MAX_STR_SIZE])
|
||||
|
25
src/toxic.c
25
src/toxic.c
@ -84,7 +84,6 @@ struct arg_opts {
|
||||
} arg_opts;
|
||||
|
||||
struct _Winthread Winthread;
|
||||
struct _FSenderThread FSenderThread;
|
||||
|
||||
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)
|
||||
{
|
||||
pthread_mutex_lock(&Winthread.lock);
|
||||
do_connection(m, prompt);
|
||||
pthread_mutex_unlock(&Winthread.lock);
|
||||
|
||||
do_file_senders(m);
|
||||
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)
|
||||
{
|
||||
fprintf(stderr, "usage: toxic [OPTION] [FILE ...]\n");
|
||||
@ -622,13 +606,6 @@ int main(int argc, char *argv[])
|
||||
|
||||
if (pthread_create(&Winthread.tid, NULL, thread_winref, (void *) m) != 0)
|
||||
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;
|
||||
|
||||
|
@ -67,11 +67,6 @@ struct _Winthread {
|
||||
pthread_mutex_t lock;
|
||||
};
|
||||
|
||||
struct _FSenderThread {
|
||||
pthread_t tid;
|
||||
pthread_mutex_t lock;
|
||||
};
|
||||
|
||||
typedef struct ToxWindow ToxWindow;
|
||||
typedef struct StatusBar StatusBar;
|
||||
typedef struct PromptBuf PromptBuf;
|
||||
|
Loading…
Reference in New Issue
Block a user