hal: testapp: pthread_exit resulting in abort
-In testapp code pthread_exit api is resulting in abort
for 64bit.
-As a fix, terminating the threads by calling return instead of
pthread_exit.
Change-Id: I2f686c3eda94470d33403b2e88d5110888995c60
diff --git a/qahw_api/test/qahw_playback_test.c b/qahw_api/test/qahw_playback_test.c
index 2469b3c..d42f89d 100644
--- a/qahw_api/test/qahw_playback_test.c
+++ b/qahw_api/test/qahw_playback_test.c
@@ -609,7 +609,7 @@
if (rc) {
fprintf(log_file, "stream %d: could not open output stream, error - %d \n", params->stream_index, rc);
fprintf(stderr, "stream %d: could not open output stream, error - %d \n", params->stream_index, rc);
- pthread_exit(0);
+ return NULL;
}
fprintf(log_file, "stream %d: open output stream is success, out_handle %p\n", params->stream_index, params->out_handle);
@@ -634,14 +634,14 @@
if (!(params->kvpair_values)) {
fprintf(log_file, "stream %d: error!!No metadata for the clip\n", params->stream_index);
fprintf(stderr, "stream %d: error!!No metadata for the clip\n", params->stream_index);
- pthread_exit(0);;
+ return NULL;
}
read_kvpair(kvpair, params->kvpair_values, params->filetype);
rc = qahw_out_set_parameters(params->out_handle, kvpair);
if(rc){
fprintf(log_file, "stream %d: failed to set kvpairs\n", params->stream_index);
fprintf(stderr, "stream %d: failed to set kvpairs\n", params->stream_index);
- pthread_exit(0);;
+ return NULL;
}
fprintf(log_file, "stream %d: kvpairs are set\n", params->stream_index);
break;
@@ -674,7 +674,7 @@
if (rc < 0) {
fprintf(log_file, "stream %d: could not create effect command thread!\n", params->stream_index);
fprintf(stderr, "stream %d: could not create effect command thread!\n", params->stream_index);
- pthread_exit(0);
+ return NULL;
}
fprintf(log_file, "stream %d: loading effects\n", params->stream_index);
@@ -766,7 +766,7 @@
if (data_ptr == NULL) {
fprintf(log_file, "stream %d: failed to allocate data buffer\n", params->stream_index);
fprintf(stderr, "stream %d: failed to allocate data buffer\n", params->stream_index);
- pthread_exit(0);
+ return NULL;
}
latency = qahw_out_get_latency(params->out_handle);
diff --git a/qahw_api/test/qap_wrapper_extn.c b/qahw_api/test/qap_wrapper_extn.c
index de79ccf..3240cb6 100644
--- a/qahw_api/test/qap_wrapper_extn.c
+++ b/qahw_api/test/qap_wrapper_extn.c
@@ -1446,22 +1446,22 @@
if (fp_input == NULL) {
fprintf(stderr, "Open File Failed for %s\n", stream_info->filename);
- pthread_exit(0);
+ return NULL;
}
qap_module_handle = stream_info->qap_module_handle;
buffer = (qap_audio_buffer_t *) calloc(1, sizeof(qap_audio_buffer_t));
if (buffer == NULL) {
fprintf(stderr, "%s::%d: Memory Alloc Error\n", __func__, __LINE__);
- pthread_exit(0);
+ return NULL;
}
buffer->common_params.data = calloc(1, FRAME_SIZE);
if (buffer->common_params.data == NULL) {
fprintf(stderr, "%s::%d: Memory Alloc Error\n", __func__, __LINE__);
- pthread_exit(0);
if (NULL != buffer) {
free( buffer);
buffer = NULL;
}
+ return NULL;
}
buffer->buffer_parms.output_buf_params.output_id = output_device_id;
fprintf(stdout, "%s::%d: output device id %d\n",
@@ -1472,13 +1472,13 @@
ret = qap_module_cmd(qap_module_handle, QAP_MODULE_CMD_START, sizeof(QAP_MODULE_CMD_START), NULL, NULL, NULL);
if (ret != QAP_STATUS_OK) {
fprintf(stderr, "START failed\n");
- pthread_exit(0);
if (NULL != buffer && NULL != buffer->common_params.data) {
free( buffer->common_params.data);
buffer->common_params.data = NULL;
free( buffer);
buffer = NULL;
}
+ return NULL;
}
do {