loc_api: Use create_thread_cb for all threads that call back into the framework.

Change-Id: I07c2d5664d3f1a167af56ddd76b60393de170931
Signed-off-by: Mike Lockwood <lockwood@android.com>
This commit is contained in:
Mike Lockwood 2010-06-20 14:31:24 -07:00
parent c6419effb6
commit 5153d56321
3 changed files with 10 additions and 35 deletions

View file

@ -91,7 +91,7 @@ static void loc_eng_report_status (const rpc_loc_status_event_s_type *status_rep
static void loc_eng_report_nmea (const rpc_loc_nmea_report_s_type *nmea_report_ptr);
static void loc_eng_process_conn_request (const rpc_loc_server_request_s_type *server_request_ptr);
static void* loc_eng_process_deferred_action (void* arg);
static void loc_eng_process_deferred_action (void* arg);
static void loc_eng_process_atl_deferred_action (int flags);
static void loc_eng_delete_aiding_data_deferred_action (void);
@ -227,10 +227,8 @@ static int loc_eng_init(GpsCallbacks* callbacks)
pthread_cond_init(&loc_eng_data.ioctl_data.cb_arrived_cond, NULL);
loc_eng_data.deferred_action_thread = NULL;
pthread_create (&(loc_eng_data.deferred_action_thread),
NULL,
loc_eng_process_deferred_action,
NULL);
loc_eng_data.deferred_action_thread = callbacks->create_thread_cb("loc_api",
loc_eng_process_deferred_action, NULL);
LOGD ("loc_eng_init called, client id = %d\n", (int32) loc_eng_data.client_handle);
return 0;
@ -937,13 +935,13 @@ static void loc_eng_report_status (const rpc_loc_status_event_s_type *status_rep
{
// GPS_STATUS_SESSION_BEGIN implies GPS_STATUS_ENGINE_ON
status.status = GPS_STATUS_SESSION_BEGIN;
loc_eng_data.status_cb (&status);
loc_eng_data.status_cb(&status);
}
else if (status_report_ptr->payload.rpc_loc_status_event_payload_u_type_u.engine_state == RPC_LOC_ENGINE_STATE_OFF)
{
// GPS_STATUS_SESSION_END implies GPS_STATUS_ENGINE_OFF
status.status = GPS_STATUS_ENGINE_OFF;
loc_eng_data.status_cb (&status);
loc_eng_data.status_cb(&status);
}
}
@ -1397,7 +1395,7 @@ SIDE EFFECTS
N/A
===========================================================================*/
static void* loc_eng_process_deferred_action (void* arg)
static void loc_eng_process_deferred_action (void* arg)
{
AGpsStatus status;
status.size = sizeof(status);
@ -1480,7 +1478,8 @@ static void* loc_eng_process_deferred_action (void* arg)
LOGD("loc_eng_process_deferred_action thread exiting\n");
loc_eng_data.release_wakelock_cb();
return NULL;
loc_eng_data.deferred_action_thread = 0;
}
// for gps.c

View file

@ -520,7 +520,7 @@ int loc_eng_ni_callback (
FUNCTION loc_ni_thread_proc
===========================================================================*/
static void* loc_ni_thread_proc(void *threadid)
static void loc_ni_thread_proc(void *unused)
{
LOGI("Starting Loc NI thread...\n");
@ -543,29 +543,6 @@ static void* loc_ni_thread_proc(void *threadid)
pthread_mutex_unlock(&loc_eng_ni_data.loc_ni_lock);
} /* while (1) */
pthread_exit(NULL);
return NULL;
}
/*===========================================================================
FUNCTION loc_ni_thread_start
===========================================================================*/
static int loc_ni_thread_start(void)
{
int rc = 0;
rc = pthread_create(&loc_eng_ni_data.loc_ni_thread, NULL, loc_ni_thread_proc, NULL);
if (rc)
{
LOGE("Loc NI thread is not created.\n");
return -1;
}
return 0;
}
/*===========================================================================
@ -591,7 +568,7 @@ void loc_eng_ni_init(GpsNiCallbacks *callbacks)
if (!loc_eng_ni_data_init)
{
pthread_mutex_init(&loc_eng_ni_data.loc_ni_lock, NULL);
loc_ni_thread_start();
callbacks->create_thread_cb("loc_api_ni", loc_ni_thread_proc, NULL);
loc_eng_ni_data_init = TRUE;
}

View file

@ -36,7 +36,6 @@ $Id:
extern const GpsNiInterface sLocEngNiInterface;
typedef struct {
pthread_t loc_ni_thread; /* NI thread */
pthread_mutex_t loc_ni_lock;
int response_time_left; /* examine time for NI response */
boolean notif_in_progress; /* NI notification/verification in progress */