summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEwald Snel <esnel@users.sourceforge.net>2003-03-03 07:37:23 +0000
committerEwald Snel <esnel@users.sourceforge.net>2003-03-03 07:37:23 +0000
commit47167d0dce603161f9ec629d0eae178c368a57b1 (patch)
tree621e5f16937a25fd477fd5bdbe50d0319fb6863e
parent48be62b54906bd6cae986a906baa9676cac3525a (diff)
downloadxine-lib-47167d0dce603161f9ec629d0eae178c368a57b1.tar.gz
xine-lib-47167d0dce603161f9ec629d0eae178c368a57b1.tar.bz2
Remove pthread_cancel() support, these threads are never pthread_cancelled
- only some input plugins (still) have this... old code from xine 0.9.x? CVS patchset: 4325 CVS date: 2003/03/03 07:37:23
-rw-r--r--src/input/input_file.c19
-rw-r--r--src/input/input_gnome_vfs.c20
-rw-r--r--src/input/input_http.c16
-rw-r--r--src/xine-engine/buffer.c27
4 files changed, 3 insertions, 79 deletions
diff --git a/src/input/input_file.c b/src/input/input_file.c
index 56da22106..ed61343df 100644
--- a/src/input/input_file.c
+++ b/src/input/input_file.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: input_file.c,v 1.74 2003/01/29 18:53:59 miguelfreitas Exp $
+ * $Id: input_file.c,v 1.75 2003/03/03 07:37:23 esnel Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -92,31 +92,17 @@ static off_t file_plugin_read (input_plugin_t *this_gen, char *buf, off_t len) {
return read (this->fh, buf, len);
}
-/*
- * helper function to release buffer
- * in case demux thread is cancelled
- */
-static void pool_release_buffer (void *arg) {
- buf_element_t *buf = (buf_element_t *) arg;
- if( buf != NULL )
- buf->free_buffer(buf);
-}
-
static buf_element_t *file_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo) {
off_t num_bytes, total_bytes;
file_input_plugin_t *this = (file_input_plugin_t *) this_gen;
buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,NULL);
- pthread_cleanup_push( pool_release_buffer, buf );
-
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;
total_bytes = 0;
while (total_bytes < todo) {
- pthread_testcancel();
num_bytes = read (this->fh, buf->mem + total_bytes, todo-total_bytes);
if (num_bytes <= 0) {
if (num_bytes < 0)
@@ -132,9 +118,6 @@ static buf_element_t *file_plugin_read_block (input_plugin_t *this_gen, fifo_buf
if( buf != NULL )
buf->size = total_bytes;
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,NULL);
- pthread_cleanup_pop(0);
-
return buf;
}
diff --git a/src/input/input_gnome_vfs.c b/src/input/input_gnome_vfs.c
index 4cf5ff46a..053ae91aa 100644
--- a/src/input/input_gnome_vfs.c
+++ b/src/input/input_gnome_vfs.c
@@ -18,7 +18,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: input_gnome_vfs.c,v 1.6 2003/02/23 03:56:10 hadess Exp $
+ * $Id: input_gnome_vfs.c,v 1.7 2003/03/03 07:37:23 esnel Exp $
*/
@@ -108,18 +108,6 @@ gnomevfs_plugin_read (input_plugin_t *this_gen, char *buf, off_t len)
return num_bytes;
}
-/*
- * helper function to release buffer
- * in case demux thread is cancelled
- */
-static void
-pool_release_buffer (void *arg)
-{
- buf_element_t *buf = (buf_element_t *) arg;
- if( buf != NULL )
- buf->free_buffer(buf);
-}
-
static buf_element_t*
gnomevfs_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo,
off_t todo)
@@ -127,9 +115,6 @@ gnomevfs_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo,
off_t total_bytes;
buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
- pthread_setcancelstate (PTHREAD_CANCEL_ENABLE,NULL);
- pthread_cleanup_push (pool_release_buffer, buf);
-
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;
@@ -144,9 +129,6 @@ gnomevfs_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo,
if (buf != NULL)
buf->size = total_bytes;
- pthread_setcancelstate (PTHREAD_CANCEL_DISABLE, NULL);
- pthread_cleanup_pop (0);
-
return buf;
}
diff --git a/src/input/input_http.c b/src/input/input_http.c
index f876885e3..c525a18fa 100644
--- a/src/input/input_http.c
+++ b/src/input/input_http.c
@@ -536,24 +536,11 @@ static int read_shoutcast_header(http_input_plugin_t *this) {
return 0;
}
-/*
- * helper function to release buffer
- * in case demux thread is cancelled
- */
-static void pool_release_buffer (void *arg) {
- buf_element_t *buf = (buf_element_t *) arg;
- if( buf != NULL )
- buf->free_buffer(buf);
-}
-
static buf_element_t *http_plugin_read_block (input_plugin_t *this_gen, fifo_buffer_t *fifo, off_t todo) {
off_t total_bytes;
buf_element_t *buf = fifo->buffer_pool_alloc (fifo);
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,NULL);
- pthread_cleanup_push( pool_release_buffer, buf );
-
buf->content = buf->mem;
buf->type = BUF_DEMUX_BLOCK;
@@ -567,9 +554,6 @@ static buf_element_t *http_plugin_read_block (input_plugin_t *this_gen, fifo_buf
if (buf != NULL)
buf->size = total_bytes;
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,NULL);
- pthread_cleanup_pop(0);
-
return buf;
}
diff --git a/src/xine-engine/buffer.c b/src/xine-engine/buffer.c
index 38aaa0ec6..af2f08242 100644
--- a/src/xine-engine/buffer.c
+++ b/src/xine-engine/buffer.c
@@ -17,7 +17,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
*
- * $Id: buffer.c,v 1.25 2003/02/23 19:27:57 tmattern Exp $
+ * $Id: buffer.c,v 1.26 2003/03/03 07:37:23 esnel Exp $
*
*
* contents:
@@ -61,21 +61,6 @@ static void buffer_pool_free (buf_element_t *element) {
}
/*
- * helper function to release buffer pool lock
- * in case demux thread is cancelled
- */
-
-void pool_release_lock (void *arg) {
-
- pthread_mutex_t *mutex = (pthread_mutex_t *) arg;
-
- /* printf ("pool release lock\n"); */
-
- pthread_mutex_unlock (mutex);
-
-}
-
-/*
* allocate a buffer from buffer pool
*/
@@ -83,10 +68,6 @@ static buf_element_t *buffer_pool_alloc (fifo_buffer_t *this) {
buf_element_t *buf;
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE,NULL);
-
- pthread_cleanup_push( pool_release_lock, &this->buffer_pool_mutex);
-
pthread_mutex_lock (&this->buffer_pool_mutex);
/* we always keep one free buffer for emergency situations like
@@ -99,14 +80,8 @@ static buf_element_t *buffer_pool_alloc (fifo_buffer_t *this) {
this->buffer_pool_top = this->buffer_pool_top->next;
this->buffer_pool_num_free--;
- pthread_cleanup_pop (0);
-
pthread_mutex_unlock (&this->buffer_pool_mutex);
- /* needed because cancellation points defined by POSIX
- (eg. 'read') would leak allocated buffers */
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE,NULL);
-
/* set sane values to the newly allocated buffer */
buf->content = buf->mem; /* 99% of demuxers will want this */
buf->pts = 0;