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