1 /* Copyright (c) 2010-2014 Samsung Electronics Co., Ltd. All rights reserved.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
19 #include "command_queue.h"
23 session::thread::thread()
27 session::thread::~thread()
31 /* Thread function: pops the item from the queue and performs the command */
32 void *session::thread::queue_thread(void *data)
34 sleep(0); /* Just switch the thread to accomplish previous
35 initialization routines */
39 plugin::plugin_s *p = (plugin::plugin_s *) data;
41 command_queue *cq = session::command_queue::interface();
43 cq->process(p); /* Continuously perform queue processing */
48 void session::thread::run(plugin::plugin_s *p)
53 return; /* Check whether the thread is already started, */
58 p->thread = g_thread_new("queue_thread", &queue_thread, p);
60 g_thread_unref(p->thread);
63 void session::thread::stop(plugin::plugin_s *p)
68 p->is_working = false;
70 command_queue *cq = session::command_queue::interface();