#include "download-agent-dl-info.h"
#include "download-agent-http-mgr.h"
-void __thread_clean_up_handler_for_start_download(void *arg)
-{
- DA_LOGI("cleanup for thread id[%lu]", pthread_self());
-}
-
da_ret_t __download_content(da_info_t *da_info)
{
da_ret_t ret = DA_RESULT_OK;
return ret;
}
-
static void *__thread_start_download(void *data)
{
da_info_t *da_info = DA_NULL;
NULL_CHECK_RET_OPT(req_info, DA_NULL);
da_id = da_info->da_id;
- pthread_cleanup_push(__thread_clean_up_handler_for_start_download, DA_NULL);
__download_content(da_info);
destroy_da_info(da_id);
- pthread_cleanup_pop(0);
DA_LOGI("=====EXIT thread : da_id[%d]=====", da_id);
pthread_exit((void *)DA_NULL);
return DA_NULL;
da_ret_t ret = DA_RESULT_OK;
http_info_t *http_info = DA_NULL;
http_state_t http_state = 0;
- int status;
int mutex_ret = 0;
DA_LOGV("");
DA_MUTEX_LOCK(&(http_info->mutex_state));
http_info->state = HTTP_STATE_CANCELED;
DA_MUTEX_UNLOCK(&(http_info->mutex_state));
- if (da_info->thread_id > 0) {
- if (pthread_cancel(da_info->thread_id) != 0) {
- DA_LOGE("Fail to cancel thread id[%lu]",
- da_info->thread_id);
- pthread_join(da_info->thread_id, (void **)&status);
- } else {
- DA_LOGI("====Exit thread with cancel:da_id[%d]===",
- da_info->da_id);
- }
- }
break;
case HTTP_STATE_WAIT_FOR_NET_ERR:
DA_MUTEX_LOCK(&(http_info->mutex_state));
Name: download-provider
Summary: Download the contents in background
-Version: 2.1.115
+Version: 2.1.116
Release: 0
Group: Development/Libraries
License: Apache-2.0
while (slot != NULL && client_sock >= 0 &&
client_sock == slot->client.channel) {
-
memset(&timeout, 0x00, sizeof(struct timeval));
timeout.tv_sec = DP_CARE_CLIENT_REQUEST_INTERVAL;
FD_ZERO(&imask);
}
if (FD_ISSET(client_sock, &imask) > 0) {
+ pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
CLIENT_MUTEX_LOCK(&slot->mutex);
- pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
client->access_time = (int)time(NULL);
errorcode = DP_ERROR_NONE;
}
free(ipc_info);
- pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
CLIENT_MUTEX_UNLOCK(&slot->mutex);
+ pthread_setcancelstate(PTHREAD_CANCEL_ENABLE, NULL);
if (errorcode == DP_ERROR_IO_ERROR ||
errorcode == DP_ERROR_OUT_OF_MEMORY ||
CLIENT_MUTEX_LOCK(&g_dp_queue_manager_mutex);
pthread_cond_timedwait(&g_dp_queue_manager_cond, &g_dp_queue_manager_mutex, &ts);
CLIENT_MUTEX_UNLOCK(&g_dp_queue_manager_mutex);
-
} while (g_dp_queue_manager_tid > 0);
TRACE_DEBUG("queue-manager's working is done");
g_dp_queue_manager_tid = 0;
pthread_cond_signal(&g_dp_queue_manager_cond);
CLIENT_MUTEX_UNLOCK(&g_dp_queue_manager_mutex);
- pthread_cancel(tid);
pthread_join(tid, (void **)&status);
}
}