2 * Copyright (C) 2010-2013 jeanfi@gmail.com
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License as
6 * published by the Free Software Foundation; either version 2 of the
7 * License, or (at your option) any later version.
9 * This program is distributed in the hope that it will be useful, but
10 * WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
25 #include <json/json.h>
30 #include "ttrss_wsasync.h"
32 static pthread_mutex_t lock = PTHREAD_MUTEX_INITIALIZER;
34 static struct json_object **requests;
36 static pthread_t *thread;
40 struct json_object **tmp, **cur, *rp, *rq;
45 pthread_mutex_lock(&lock);
52 pthread_mutex_unlock(&lock);
67 log_debug("loop() done");
74 void ws_async_set_article_unread(int id, int unread)
76 struct json_object *rq, **tmp;
78 log_debug("ws_async_set_article_unread(%d,%d)", id, unread);
80 rq = ws_request_new_set_article_unread(id, unread);
82 pthread_mutex_lock(&lock);
84 thread = malloc(sizeof(pthread_t));
85 pthread_create(thread, NULL, loop, NULL);
88 tmp = (struct json_object **)list_add((void **)requests, rq);
89 list_free((void **)requests);
91 pthread_mutex_unlock(&lock);
93 log_debug("ws_async_set_article_unread(%d,%d) done", id, unread);