summaryrefslogtreecommitdiff
path: root/libavformat/udp.c
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-05-08 19:36:06 +0200
committerNicolas George <nicolas.george@normalesup.org>2012-05-14 19:32:43 +0200
commit281bde27894f994d0982ab9283f15d6073ae352c (patch)
tree116e7e4ae183d1c87c95ca0919e56f00a910de01 /libavformat/udp.c
parent83f954e85939527ed86e6343bfe1b8453d838abe (diff)
udp: check for HAVE_PTHREAD_CANCEL instead of HAVE_PTHREADS.
Some environments, for example Android, pretend to have pthreads but actually have only a partial implementation.
Diffstat (limited to 'libavformat/udp.c')
-rw-r--r--libavformat/udp.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/libavformat/udp.c b/libavformat/udp.c
index 9387e218d0..51d7ed0d5a 100644
--- a/libavformat/udp.c
+++ b/libavformat/udp.c
@@ -38,7 +38,7 @@
#include "os_support.h"
#include "url.h"
-#if HAVE_PTHREADS
+#if HAVE_PTHREAD_CANCEL
#include <pthread.h>
#endif
@@ -68,7 +68,7 @@ typedef struct {
int circular_buffer_size;
AVFifoBuffer *fifo;
int circular_buffer_error;
-#if HAVE_PTHREADS
+#if HAVE_PTHREAD_CANCEL
pthread_t circular_buffer_thread;
pthread_mutex_t mutex;
pthread_cond_t cond;
@@ -321,7 +321,7 @@ static int udp_get_file_handle(URLContext *h)
return s->udp_fd;
}
-#if HAVE_PTHREADS
+#if HAVE_PTHREAD_CANCEL
static void *circular_buffer_task( void *_URLContext)
{
URLContext *h = _URLContext;
@@ -526,7 +526,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
s->udp_fd = udp_fd;
-#if HAVE_PTHREADS
+#if HAVE_PTHREAD_CANCEL
if (!is_output && s->circular_buffer_size) {
int ret;
@@ -552,7 +552,7 @@ static int udp_open(URLContext *h, const char *uri, int flags)
#endif
return 0;
-#if HAVE_PTHREADS
+#if HAVE_PTHREAD_CANCEL
thread_fail:
pthread_cond_destroy(&s->cond);
cond_fail:
@@ -571,7 +571,7 @@ static int udp_read(URLContext *h, uint8_t *buf, int size)
int ret;
int avail, nonblock = h->flags & AVIO_FLAG_NONBLOCK;
-#if HAVE_PTHREADS
+#if HAVE_PTHREAD_CANCEL
if (s->fifo) {
pthread_mutex_lock(&s->mutex);
do {
@@ -652,7 +652,7 @@ static int udp_close(URLContext *h)
udp_leave_multicast_group(s->udp_fd, (struct sockaddr *)&s->dest_addr);
closesocket(s->udp_fd);
av_fifo_free(s->fifo);
-#if HAVE_PTHREADS
+#if HAVE_PTHREAD_CANCEL
if (s->thread_started) {
pthread_cancel(s->circular_buffer_thread);
ret = pthread_join(s->circular_buffer_thread, NULL);