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"
22 session::thread::thread()
26 session::thread::~thread()
30 /* Thread function: pops the item from the queue and performs the command */
31 void *session::thread::queue_thread(void *data)
33 sleep(0); /* Just switch the thread to accomplish previous
34 initialization routines */
38 plugin::plugin_s *p = (plugin::plugin_s *) data;
40 command_queue *cq = session::command_queue::interface();
42 cq->process(p); /* Continuously perform queue processing */
47 void session::thread::run(plugin::plugin_s *p)
52 return; /* Check whether the thread is already started, */
57 p->thread = g_thread_new("queue_thread", &queue_thread, p);
59 g_thread_unref(p->thread);
62 void session::thread::stop(plugin::plugin_s *p)
67 p->is_working = false;
69 command_queue *cq = session::command_queue::interface();