OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
task_thread_api.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2017 Juniper Networks, Inc. All rights reserved.
3  */
4 
5 #ifndef vnsw_agent_task_thread_api_h
6 #define vnsw_agent_task_thread_api_h
7 
8 #include "mcast_common.h"
9 
10 typedef struct thread_ {
11  struct thread_ *next;
12  struct thread_ *prev;
13 } task_thread;
14 
15 #define THREAD_TO_STRUCT(function, structure, member) \
16  static inline structure * (function)(task_thread *address) { \
17  if (address) { \
18  return (structure *)((char*)address - offsetof(structure, member));\
19  } \
20  return NULL; \
21  }
22 
23 extern void thread_new_circular_thread(task_thread *head);
24 extern boolean thread_circular_thread_empty(task_thread *head);
25 extern boolean thread_circular_thread_head(task_thread *head, task_thread *node);
26 extern boolean thread_node_on_thread(const task_thread *node);
28 extern void thread_circular_add_top(task_thread *head, task_thread *node);
29 extern void thread_circular_add_bottom(task_thread *head, task_thread *node);
33 extern void thread_remove(task_thread *node);
34 
35 #define FOR_ALL_CIRCULAR_THREAD_ENTRIES(head, current) \
36  for ((current) = thread_next_node(head); \
37  !thread_circular_thread_head(head, (current)); \
38  (current) = thread_next_node(current))
39 
40 #endif /* vnsw_agent_task_thread_api_h */
task_thread * thread_next_node(task_thread *node)
boolean thread_circular_thread_empty(task_thread *head)
task_thread * thread_circular_top(task_thread *head)
struct thread_ task_thread
task_thread * thread_circular_dequeue_top(task_thread *head)
struct thread_ * next
task_thread * thread_circular_thread_next(task_thread *head, task_thread *node)
boolean thread_node_on_thread(const task_thread *node)
void thread_circular_add_bottom(task_thread *head, task_thread *node)
void thread_new_circular_thread(task_thread *head)
void thread_circular_add_top(task_thread *head, task_thread *node)
struct thread_ * prev
void thread_remove(task_thread *node)
boolean thread_circular_thread_head(task_thread *head, task_thread *node)