4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
6 * Contact: JuHak Park <juhaki.park@samsung.com>,
7 * JuneHyuk Lee <junhyuk7.lee@samsung.com>,
8 * SunBong Ha <sunbong.ha@samsung.com>
10 * Licensed under the Apache License, Version 2.0 (the "License");
11 * you may not use this file except in compliance with the License.
12 * You may obtain a copy of the License at
14 * http://www.apache.org/licenses/LICENSE-2.0
16 * Unless required by applicable law or agreed to in writing, software
17 * distributed under the License is distributed on an "AS IS" BASIS,
18 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19 * See the License for the specific language governing permissions and
20 * limitations under the License.
28 * For any sort of issue you concern as to this software,
29 * you may use following point of contact.
30 * All resources contributed on this software
31 * are orinigally written by S-Core Inc., a member of Samsung Group.
33 * JungWook Ryu <jungwook.ryu@samsung.com>
36 #ifndef FW_ASYNC_QUEUE_H_
37 #define FW_ASYNC_QUEUE_H_
42 * @file fw_async_queue.h
43 * @brief provide DataStructure - asynchronous Queue
47 * @brief determine priority
48 * @param[in] msg1 item
49 * @param[in] msg2 compare item
50 * @param[in] user_data user_data
52 * @see fw_async_queue_send_msg_with_compare_priority()
54 typedef int (*compare_priority_func) (const void *msg1, const void *msg2, void *user_data);
57 * @brief asynchronous Queue
59 typedef struct fw_async_queue_s fw_async_queue_t;
60 struct fw_async_queue_s {
61 GAsyncQueue *pQueue; /**< real queue data structure */
65 * @brief create empty asynchronous Queue
66 * @return created asynchronous queue on success, otherwise a null pointer.
68 fw_async_queue_t *fw_async_queue_alloc();
71 * @brief destroy asynchronous Queue
72 * @param[in] pQueue asynchronous Queue
74 void fw_async_queue_destroy(fw_async_queue_t *pQueue);
77 * @brief lock asynchronous Queue
78 * @param[in] pQueue asynchronous Queue
80 void fw_async_queue_lock(fw_async_queue_t *pQueue);
83 * @brief unlock asynchronous Queue
84 * @param[in] pQueue asynchronous Queue
86 void fw_async_queue_unlock(fw_async_queue_t *pQueue);
89 * @brief pop item from asynchronous Queue
90 * @remarks blocking until enter item to Queue
91 * @param[in] pQueue asynchronous Queue
92 * return item on success, otherwise null pointer
94 void *fw_async_queue_receive_msg(fw_async_queue_t *pQueue);
97 * @brief send item to asynchronous Queue
98 * @param[in] pQueue asynchronous Queue
101 void fw_async_queue_send_msg(fw_async_queue_t *pQueue, void *msg);
104 * @brief send item to asynchronous Queue with priority
105 * @param[in] pQueue asynchronous Queue
106 * @param[in] msg item
107 * @param[in] cpf priority for callback function
108 * @param[in] user_data user_data
110 void fw_async_queue_send_msg_with_compare_priority(fw_async_queue_t *pQueue, void *msg, compare_priority_func cpf, void *user_data);
112 #endif /* FW_ASYNC_QUEUE_H_ */