static void __msc_add_event_receiver(void *data);
static void __msc_remove_event_receiver(void);
-static void _power_off_cb(void* data)
+static void __push_power_off(GAsyncQueue *queue)
{
- ms_comm_msg_s *scan_data = NULL;
- ms_comm_msg_s *reg_data = NULL;
+ if (!queue)
+ return;
- MS_DBG_ERR("POWER OFF CB Begin");
+ ms_comm_msg_s *_data = g_new0(ms_comm_msg_s, 1);
+ _data->pid = POWEROFF;
+
+ g_async_queue_push(queue, _data);
+}
+static void __power_off_cb(void)
+{
+ MS_DBG_ERR("POWER OFF CB Begin");
//display_lock_state(POWER_STATE_STANDBY, 0);
power_off2 = true;
- if (scan_queue2) {
- /*notify to scannig thread*/
- scan_data = g_new0(ms_comm_msg_s, 1);
-
- scan_data->pid = POWEROFF;
- g_async_queue_push(scan_queue2, scan_data);
- }
-
- if (reg_queue2) {
- /*notify to register thread*/
- reg_data = g_new0(ms_comm_msg_s, 1);
-
- reg_data->pid = POWEROFF;
- g_async_queue_push(reg_queue2, reg_data);
- }
-
- if (storage_queue2) {
- /*notify to register thread*/
- reg_data = g_new0(ms_comm_msg_s, 1);
-
- reg_data->pid = POWEROFF;
- g_async_queue_push(storage_queue2, reg_data);
- }
-
- if (storage_extract_queue) {
- /*notify to storage extract thread*/
- reg_data = g_new0(ms_comm_msg_s, 1);
-
- reg_data->pid = POWEROFF;
- g_async_queue_push(storage_extract_queue, reg_data);
- }
-
- if (folder_extract_queue) {
- /*notify to folder extract thread*/
- reg_data = g_new0(ms_comm_msg_s, 1);
-
- reg_data->pid = POWEROFF;
- g_async_queue_push(folder_extract_queue, reg_data);
- }
+ __push_power_off(scan_queue2);
+ __push_power_off(reg_queue2);
+ __push_power_off(storage_queue2);
+ __push_power_off(storage_extract_queue);
+ __push_power_off(folder_extract_queue);
g_source_remove(scanner_source_id2);
static int __msc_power_off_cb(int option, void *data)
{
- _power_off_cb(NULL);
+ __power_off_cb();
return MS_MEDIA_ERR_NONE;
}