summaryrefslogtreecommitdiff
path: root/src/xine-engine
diff options
context:
space:
mode:
authorJuergen Keil <jkeil@users.sourceforge.net>2001-10-03 17:15:43 +0000
committerJuergen Keil <jkeil@users.sourceforge.net>2001-10-03 17:15:43 +0000
commit70564011218ab5eef38842412af9313b2a133f69 (patch)
treedda4a4296e74ddb4c07c14aa7eea471eef9bbe15 /src/xine-engine
parent2341ac8aa13c8ad994eab1fbbefe98238ed4f117 (diff)
downloadxine-lib-70564011218ab5eef38842412af9313b2a133f69.tar.gz
xine-lib-70564011218ab5eef38842412af9313b2a133f69.tar.bz2
Add error checks to all "pthread_create" calls, print error message and exit
xine, whenever a pthread_create fails CVS patchset: 729 CVS date: 2001/10/03 17:15:43
Diffstat (limited to 'src/xine-engine')
-rw-r--r--src/xine-engine/audio_decoder.c13
-rw-r--r--src/xine-engine/metronom.c9
-rw-r--r--src/xine-engine/video_decoder.c14
-rw-r--r--src/xine-engine/video_out.c10
4 files changed, 34 insertions, 12 deletions
diff --git a/src/xine-engine/audio_decoder.c b/src/xine-engine/audio_decoder.c
index f6995c439..0235ba7fc 100644
--- a/src/xine-engine/audio_decoder.c
+++ b/src/xine-engine/audio_decoder.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: audio_decoder.c,v 1.42 2001/10/01 23:04:57 f1rmb Exp $
+ * $Id: audio_decoder.c,v 1.43 2001/10/03 17:15:43 jkeil Exp $
*
*
* functions that implement audio decoding
@@ -27,6 +27,9 @@
#include "config.h"
#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
#include <sched.h>
#include <unistd.h>
@@ -268,6 +271,7 @@ void audio_decoder_init (xine_t *this) {
pthread_attr_t pth_attrs;
struct sched_param pth_params;
+ int err;
if (this->audio_out == NULL) {
this->audio_finished = 1;
@@ -283,7 +287,12 @@ void audio_decoder_init (xine_t *this) {
pthread_attr_setschedparam(&pth_attrs, &pth_params);
pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
- pthread_create (&this->audio_thread, &pth_attrs, audio_decoder_loop, this) ;
+ if ((err = pthread_create (&this->audio_thread,
+ &pth_attrs, audio_decoder_loop, this)) != 0) {
+ fprintf (stderr, "audio_decoder: can't create new thread (%s)\n",
+ strerror(err));
+ exit (1);
+ }
}
void audio_decoder_shutdown (xine_t *this) {
diff --git a/src/xine-engine/metronom.c b/src/xine-engine/metronom.c
index ad52e2012..4f93a736f 100644
--- a/src/xine-engine/metronom.c
+++ b/src/xine-engine/metronom.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: metronom.c,v 1.28 2001/09/25 23:30:38 guenter Exp $
+ * $Id: metronom.c,v 1.29 2001/10/03 17:15:44 jkeil Exp $
*/
#ifdef HAVE_CONFIG_H
@@ -742,6 +742,7 @@ static int metronom_sync_loop (metronom_t *this) {
metronom_t * metronom_init (int have_audio) {
metronom_t *this = xmalloc (sizeof (metronom_t));
+ int err;
this->audio_stream_start = metronom_audio_stream_start;
this->audio_stream_end = metronom_audio_stream_end ;
@@ -769,10 +770,10 @@ metronom_t * metronom_init (int have_audio) {
this->scr_list = calloc(MAX_SCR_PROVIDERS, sizeof(void*));
this->register_scr(this, unixscr_init());
- if (pthread_create(&this->sync_thread, NULL,
- (void*(*)(void*)) metronom_sync_loop, this))
+ if ((err = pthread_create(&this->sync_thread, NULL,
+ (void*(*)(void*)) metronom_sync_loop, this)) != 0)
fprintf(stderr, "metronom: cannot create sync thread (%s)\n",
- strerror(errno));
+ strerror(err));
pthread_mutex_init (&this->lock, NULL);
pthread_cond_init (&this->video_started, NULL);
diff --git a/src/xine-engine/video_decoder.c b/src/xine-engine/video_decoder.c
index 971b38d0b..5611964ed 100644
--- a/src/xine-engine/video_decoder.c
+++ b/src/xine-engine/video_decoder.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: video_decoder.c,v 1.52 2001/09/26 01:18:19 guenter Exp $
+ * $Id: video_decoder.c,v 1.53 2001/10/03 17:15:44 jkeil Exp $
*
*/
@@ -25,6 +25,10 @@
#include "config.h"
#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
#include "xine_internal.h"
#include "monitor.h"
#include <sched.h>
@@ -252,6 +256,7 @@ void video_decoder_init (xine_t *this) {
pthread_attr_t pth_attrs;
struct sched_param pth_params;
+ int err;
this->video_fifo = fifo_buffer_new (500, 4096);
@@ -265,7 +270,12 @@ void video_decoder_init (xine_t *this) {
pthread_attr_setschedparam(&pth_attrs, &pth_params);
pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
- pthread_create (&this->video_thread, &pth_attrs, video_decoder_loop, this) ;
+ if ((err = pthread_create (&this->video_thread,
+ &pth_attrs, video_decoder_loop, this)) != 0) {
+ fprintf (stderr, "video_decoder: can't create new thread (%s)\n",
+ strerror(err));
+ exit (1);
+ }
}
void video_decoder_shutdown (xine_t *this) {
diff --git a/src/xine-engine/video_out.c b/src/xine-engine/video_out.c
index 97b228327..142488a48 100644
--- a/src/xine-engine/video_out.c
+++ b/src/xine-engine/video_out.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: video_out.c,v 1.49 2001/10/03 14:11:54 miguelfreitas Exp $
+ * $Id: video_out.c,v 1.50 2001/10/03 17:15:44 jkeil Exp $
*
*/
@@ -337,6 +337,7 @@ static uint32_t vo_get_capabilities (vo_instance_t *this) {
static void vo_open (vo_instance_t *this) {
pthread_attr_t pth_attrs;
+ int err;
if (!this->video_loop_running) {
this->video_loop_running = 1;
@@ -344,11 +345,12 @@ static void vo_open (vo_instance_t *this) {
pthread_attr_init(&pth_attrs);
pthread_attr_setscope(&pth_attrs, PTHREAD_SCOPE_SYSTEM);
- if( pthread_create (&this->video_thread, &pth_attrs, video_out_loop, this) )
+ if((err = pthread_create (&this->video_thread,
+ &pth_attrs, video_out_loop, this)) != 0)
{
- printf ("video_out: error creating thread\n");
+ fprintf (stderr, "video_out: can't create thread (%s)\n", strerror(err));
/* FIXME: why pthread_create fails? */
- printf ("Sorry, this should not happen. Please restart Xine.\n");
+ fprintf (stderr, "Sorry, this should not happen. Please restart Xine.\n");
exit(1);
}
else