aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md2
-rwxr-xr-xbuild2
-rw-r--r--easy-tg.c17
3 files changed, 1 insertions, 20 deletions
diff --git a/README.md b/README.md
index 8c6e9ba..e8c3fe1 100644
--- a/README.md
+++ b/README.md
@@ -10,8 +10,6 @@ Easy-to-use helpers for TDLib JSON.
* json-c
-* pthread (if you compile with `TG_ENABLE_PTHREAD`)
-
## Functions
* Automatically handles authorization state changes.
diff --git a/build b/build
index 9191837..c906eec 100755
--- a/build
+++ b/build
@@ -1,5 +1,5 @@
#!/bin/sh
set -ex
-cc -o easy-td.o -std=c99 -I. -DTG_ENABLE_PTHREAD -DTG_DEBUG -fsanitize=address -rdynamic -O0 -g3 -c easy-tg.c
+cc -o easy-td.o -std=c99 -I. -DTG_DEBUG -fsanitize=address -rdynamic -O0 -g3 -c easy-tg.c
cc -o example.o -std=c99 -I. -DAPI_ID=114514 -DAPI_HASH="\"hhhhhAAAAA\"" -fsanitize=address -rdynamic -O0 -g3 -c example.c
cc -o example -std=c99 -lpthread -ltdjson -ljson-c -fsanitize=address easy-td.o example.o
diff --git a/easy-tg.c b/easy-tg.c
index 1d89a2b..baac4a8 100644
--- a/easy-tg.c
+++ b/easy-tg.c
@@ -18,11 +18,6 @@ const void *tg_reg4 = NULL;
const void *tg_reg5 = NULL;
const void *tg_reg6 = NULL;
-#ifdef TG_ENABLE_PTHREAD
-#include <pthread.h>
-static pthread_mutex_t mutex_close = PTHREAD_MUTEX_INITIALIZER;
-#endif
-
json_object *tg_mkreq(const char *extra, const char *type, const char *args_key, json_object *args)
{
json_object *root = json_object_new_object();
@@ -233,18 +228,12 @@ cleanup:
int tg_destroy()
{
-#ifdef TG_ENABLE_PTHREAD
- pthread_mutex_lock(&mutex_close);
-#endif
if(td == NULL)
{
return 0;
}
td_json_client_destroy(td);
td = NULL;
-#ifdef TG_ENABLE_PTHREAD
- pthread_mutex_unlock(&mutex_close);
-#endif
return 0;
}
@@ -287,14 +276,8 @@ cleanup:
int tg_close()
{
-#ifdef TG_ENABLE_PTHREAD
- pthread_mutex_lock(&mutex_close);
-#endif
if(td == NULL) return 0;
/* Using json object seems to be leaking */
tg_send_raw(false, "{ \"@type\": \"close\" }");
-#ifdef TG_ENABLE_PTHREAD
- pthread_mutex_unlock(&mutex_close);
-#endif
return 0;
}