mirror_frr/lib
Quentin Young a45dc9742c
lib: streamline frr_pthreads, add default loop
Some work on FRR's pthread wrapper.

* Provide a built-in way to synchronize thread startup
* Make utility functions take frr_pthread * instead of its integer ID
* Pass frr_pthread * as pthread start function argument
* Correct some comment styling
* Rename some variables to match naming conventions in the file
* Change parameter ordering in stop function prototype to follow the
  convention in the other functions
* Default new frr_pthreads to using a vanilla event loop

For the last point, the original goal when designing the implementation
of pthreads into FRR was to be able to use the thread.c event based
system inside pthreads. This code essentially encapuslates all the
thread.c functionality into an easy to use pthread out of the box.
Creating a new frr_pthread with a null attributes field will cause the
created frr_pthread to run a thread.c event loop. The upshot of this is
that it is now possible to safely run existing functions in a pthread in
roughly 3 lines of code. It also serves as an example / starting point
for others.

Signed-off-by: Quentin Young <qlyoung@cumulusnetworks.com>
2018-01-24 15:30:50 -05:00
..
.gitignore build: convert lib/ to non-recursive build 2017-07-31 23:03:27 +02:00
agentx.c *: reindent 2017-07-17 14:04:07 +02:00
bfd.c lib: Fix abbreviation 2017-09-29 11:53:53 -04:00
bfd.h *: reindent 2017-07-17 14:04:07 +02:00
bitfield.h *: reindent 2017-07-17 14:04:07 +02:00
buffer.c lib: Cleanup some missed reformat 2017-10-23 18:09:23 -04:00
buffer.h *: reindent 2017-07-17 14:04:07 +02:00
checksum.c Revert "*: reindent pt. 2" 2017-07-22 14:52:33 +02:00
checksum.h *: reindent 2017-07-17 14:04:07 +02:00
clippy.c *: reindent 2017-07-17 14:04:07 +02:00
clippy.h lib: clippy the assistant 2017-06-14 19:29:23 +02:00
command_graph.c lib: add CLI token for 48-bit mac addresses 2017-08-11 12:42:01 -04:00
command_graph.h lib: add CLI token for 48-bit mac addresses 2017-08-11 12:42:01 -04:00
command_lex.l *: support keywords that begin with uppercase letter 2017-09-14 18:07:30 +00:00
command_match.c lib, bgpd: fixup use of of CMD_ARGC_MAX 2018-01-11 11:31:45 -05:00
command_match.h *: reindent 2017-07-17 14:04:07 +02:00
command_parse.y lib: add CLI token for 48-bit mac addresses 2017-08-11 12:42:01 -04:00
command_py.c lib: Fix small memory leak when using command_py.c 2017-10-17 09:22:41 -04:00
command.c Merge pull request #1436 from rtrlib/rpki 2017-11-13 13:35:22 -05:00
command.h lib, bgpd: fixup use of of CMD_ARGC_MAX 2018-01-11 11:31:45 -05:00
compiler.h lib: split off compiler magic into its own file 2017-08-24 00:18:53 +02:00
csv.c lib: Fix gcc 7 warning 'error: ‘fld’ may be used uninitialized in this function' 2017-12-05 00:30:29 -08:00
csv.h *: reindent 2017-07-17 14:04:07 +02:00
defun_lex.l build: convert lib/ to non-recursive build 2017-07-31 23:03:27 +02:00
distribute.c *: reindent 2017-07-17 14:04:07 +02:00
distribute.h *: reindent 2017-07-17 14:04:07 +02:00
event_counter.c *: reindent 2017-07-17 14:04:07 +02:00
event_counter.h *: reindent 2017-07-17 14:04:07 +02:00
ferr.c lib: fix wrong warning from clang 2017-10-09 13:07:50 +02:00
ferr.h lib: CMD_FERR_RETURN should return CMD_WARNING_CONFIG_FAILED 2017-09-18 15:07:40 +00:00
fifo.h *: reindent 2017-07-17 14:04:07 +02:00
filter.c bgpd: Intialize all the variables used in argv_find. 2017-09-20 14:56:23 -07:00
filter.h *: reindent 2017-07-17 14:04:07 +02:00
freebsd-queue.h lib: cleanup the work queue implementation 2017-08-17 17:47:07 +02:00
frr_pthread.c lib: streamline frr_pthreads, add default loop 2018-01-24 15:30:50 -05:00
frr_pthread.h lib: streamline frr_pthreads, add default loop 2018-01-24 15:30:50 -05:00
frr_zmq.c lib: Address ZMQ lib TODOs 2017-11-23 12:50:27 +01:00
frr_zmq.h lib: Address ZMQ lib TODOs 2017-11-23 12:50:27 +01:00
frratomic.h *: reindent 2017-07-17 14:04:07 +02:00
getopt1.c *: reindent 2017-07-17 14:04:07 +02:00
getopt.c Revert "*: reindent pt. 2" 2017-07-22 14:52:33 +02:00
getopt.h *: reindent 2017-07-17 14:04:07 +02:00
gitversion.pl build: make gitversion more useful 2017-08-02 02:59:51 +02:00
grammar_sandbox_main.c lib/bgpd: provide/use API to get hostname/domainname 2017-08-24 16:37:16 -07:00
grammar_sandbox.c lib, bgpd: fixup use of of CMD_ARGC_MAX 2018-01-11 11:31:45 -05:00
graph.c *: reindent 2017-07-17 14:04:07 +02:00
graph.h *: reindent 2017-07-17 14:04:07 +02:00
hash.c *: fix coverity warnings - resource leaks 2017-10-24 19:30:30 -02:00
hash.h lib: use load factor as hash expansion trigger 2017-08-09 13:53:11 -04:00
hook.c lib: hooks: support priority ordering & reversing 2017-08-15 13:25:41 +02:00
hook.h lib: hooks: support priority ordering & reversing 2017-08-15 13:25:41 +02:00
if_rmap.c lib: Hash creation cleanup 2017-09-05 14:33:01 -04:00
if_rmap.h *: reindent 2017-07-17 14:04:07 +02:00
if.c lib: Allow interface lookup by VRF_UNKNOWN 2018-01-12 09:19:43 -05:00
if.h lib: Allow interface lookup by VRF_UNKNOWN 2018-01-12 09:19:43 -05:00
imsg-buffer.c lib: standardize use of queue.h 2017-08-17 17:47:05 +02:00
imsg.c lib: standardize use of queue.h 2017-08-17 17:47:05 +02:00
imsg.h lib: revert reindent of files imported from OpenBSD 2017-07-24 18:40:24 -03:00
ipaddr.h *: reindent 2017-07-17 14:04:07 +02:00
jhash.c *: reindent 2017-07-17 14:04:07 +02:00
jhash.h *: reindent 2017-07-17 14:04:07 +02:00
json.c *: reindent 2017-07-17 14:04:07 +02:00
json.h ospfd: show ip ospf route json support 2017-11-26 09:18:19 -08:00
keychain.c *: add missing \n in some help strings 2017-10-24 19:30:30 -02:00
keychain.h *: reindent 2017-07-17 14:04:07 +02:00
libfrr.c lib, ldpd: fix "argument cannot be negative" coverity warnings 2017-10-05 22:51:23 -03:00
libfrr.h lib: add -N/--pathspace option 2017-08-28 23:50:42 +02:00
libospf.h ospf: Fix segfault if compiled with DEBUG 2017-08-09 12:07:58 +02:00
linklist.c *: Convert list_free usage to list_delete 2017-10-05 10:53:17 -04:00
linklist.h lib: linklist avoid access NULL->data 2017-10-09 10:51:03 +02:00
log_int.h *: reindent 2017-07-17 14:04:07 +02:00
log.c zebra, lib: zebra changes for symmetric routing support 2017-12-14 10:56:44 -08:00
log.h lib: plug logging hole during startup 2017-08-02 23:36:42 +02:00
Makefile build: convert lib/ to non-recursive build 2017-07-31 23:03:27 +02:00
md5.c *: Remove cvs control points 2017-12-05 17:28:12 -05:00
md5.h *: Remove cvs control points 2017-12-05 17:28:12 -05:00
memory_vty.c *: reindent 2017-07-17 14:04:07 +02:00
memory_vty.h *: reindent 2017-07-17 14:04:07 +02:00
memory.c lib: centralized memstats-at-exit 2017-08-24 00:18:50 +02:00
memory.h lib: split off compiler magic into its own file 2017-08-24 00:18:53 +02:00
module.c *: fix compiler warnings 2017-08-26 01:46:40 +02:00
module.h *: reindent 2017-07-17 14:04:07 +02:00
monotime.h *: Define the number of seconds in a Day, Week and year 2017-08-08 09:06:22 -04:00
mpls.h lib, zebra: Rename and place appropriately the label stack 2018-01-22 11:55:22 -05:00
network.c *: reindent 2017-07-17 14:04:07 +02:00
network.h *: reindent 2017-07-17 14:04:07 +02:00
nexthop.c lib, zebra: Rename and place appropriately the label stack 2018-01-22 11:55:22 -05:00
nexthop.h lib, zebra: Rename and place appropriately the label stack 2018-01-22 11:55:22 -05:00
ns.c *: use clang's 'ForEachMacros' format style option 2017-09-15 14:53:46 -03:00
ns.h lib: ns_id_t changed to 32 bit 2018-01-22 13:52:24 +01:00
openbsd-queue.h *: reindent 2017-07-17 14:04:07 +02:00
openbsd-tree.c lib: fix corrupted RB trees 2017-07-24 18:50:45 -03:00
openbsd-tree.h lib: revert reindent of files imported from OpenBSD 2017-07-24 18:40:24 -03:00
pid_output.c lib: log error details if F_SETLK fails 2017-09-21 13:27:50 -03:00
plist_int.h *: reindent 2017-07-17 14:04:07 +02:00
plist.c *: make clippy usage more consistent 2017-12-04 19:46:38 -02:00
plist.h lib: Modify prefix_list_apply to allow retrieval of prefix 2017-08-31 10:30:19 -04:00
pqueue.c *: reindent 2017-07-17 14:04:07 +02:00
pqueue.h *: reindent 2017-07-17 14:04:07 +02:00
prefix.c bgpd: advertise/withdraw type-5 routes upon user config 2017-12-14 10:57:07 -08:00
prefix.h bgpd, lib, zebra: fix style problems 2017-12-27 11:47:10 -08:00
privs.c lib: terminate capabilities only if initialized 2017-08-21 21:53:46 +02:00
privs.h lib: privs: make uid/gid accessible before setuid 2017-08-02 23:36:39 +02:00
ptm_lib.c lib: Allow memory to be cleaned up for error cases in ptm 2017-12-04 18:59:47 -05:00
ptm_lib.h lib: Allow memory to be cleaned up for error cases in ptm 2017-12-04 18:59:47 -05:00
pw.h ldpd: integrate with the pseudowire manager in zebra 2017-08-09 12:35:16 +02:00
qobj.c lib: Hash creation cleanup 2017-09-05 14:33:01 -04:00
qobj.h *: reindent 2017-07-17 14:04:07 +02:00
queue.h lib: standardize use of queue.h 2017-08-17 17:47:05 +02:00
ringbuf.c lib: fix a few bugs in ring buffers 2018-01-03 14:04:43 -05:00
ringbuf.h lib: add ringbuf_copy() 2018-01-03 14:04:43 -05:00
route_types.pl *: remove VTYNL, part 6 of 6 2017-07-14 10:20:03 +02:00
route_types.txt sharpd: Add Super Happy Advanced Routing Protocol 2017-11-27 09:16:30 -05:00
routemap.c lib: Fix nexthop reading to work better 2017-11-06 11:20:40 -05:00
routemap.h Merge pull request #1075 from donaldsharp/rip_metric 2017-09-05 18:17:52 +02:00
sbuf.c lib: add sbuf 2017-08-03 11:34:01 +02:00
sbuf.h lib: add sbuf 2017-08-03 11:34:01 +02:00
sha256.c lib: Fix memset usage 2017-10-03 12:03:56 -04:00
sha256.h *: reindent 2017-07-17 14:04:07 +02:00
sigevent.c lib: centralized memstats-at-exit 2017-08-24 00:18:50 +02:00
sigevent.h *: reindent 2017-07-17 14:04:07 +02:00
skiplist.c *: fix be32 reading / 24-bit left shift 2017-09-09 19:50:58 +02:00
skiplist.h *: reindent 2017-07-17 14:04:07 +02:00
smux.c Revert "*: reindent pt. 2" 2017-07-22 14:52:33 +02:00
smux.h *: reindent 2017-07-17 14:04:07 +02:00
snmp.c *: reindent 2017-07-17 14:04:07 +02:00
sockopt.c Revert "*: reindent pt. 2" 2017-07-22 14:52:33 +02:00
sockopt.h *: reindent 2017-07-17 14:04:07 +02:00
sockunion.c lib: optimize sockunion_connect() 2017-10-24 19:30:31 -02:00
sockunion.h zebra: kernel_socket: read extra attributes 2017-08-28 05:52:12 +02:00
spf_backoff.c *: fix compiler warnings 2017-08-26 01:46:40 +02:00
spf_backoff.h *: reindent 2017-07-17 14:04:07 +02:00
srcdest_table.c *: reindent 2017-07-17 14:04:07 +02:00
srcdest_table.h *: reindent 2017-07-17 14:04:07 +02:00
stream.c lib: Add STREAM_GETX functions 2017-11-13 14:15:24 -05:00
stream.h *: don't use deprecated stream.h macros 2017-12-01 13:51:06 -05:00
strlcat.c *: reindent 2017-07-17 14:04:07 +02:00
strlcpy.c *: reindent 2017-07-17 14:04:07 +02:00
subdir.am lib: add ring buffer 2017-12-19 17:12:43 -05:00
systemd.c *: reindent 2017-07-17 14:04:07 +02:00
systemd.h *: reindent 2017-07-17 14:04:07 +02:00
table.c lib: No need to call apply_mask 2 times 2017-10-16 14:47:08 -04:00
table.h lib: fix const-check in route_node 2017-08-22 15:27:08 +02:00
termtable.c *: fix compiler warnings 2017-08-26 01:46:40 +02:00
termtable.h *: reindent 2017-07-17 14:04:07 +02:00
thread.c lib: avoid crash when cancelling invalid rw job 2018-01-16 15:28:26 -05:00
thread.h lib: fix thread scheduling weirdness 2017-08-31 19:00:00 -04:00
vector.c *: reindent 2017-07-17 14:04:07 +02:00
vector.h *: reindent 2017-07-17 14:04:07 +02:00
version.h.in Rename: FreeRangeRouting FRRouting 2017-03-30 14:22:35 -04:00
vlan.h lib: VLAN definition 2017-05-25 10:20:03 -07:00
vrf_int.h *: reindent 2017-07-17 14:04:07 +02:00
vrf.c lib: vrf_bitmap_groups increased from 8 to 1024 2018-01-22 13:52:23 +01:00
vrf.h lib: increase vrf_id from 16 bit to 32 bit identifier 2018-01-22 13:52:17 +01:00
vty.c lib: Fix non-integrated config error display 2017-10-25 22:35:35 -04:00
vty.h lib: add vty_frame() to get rid of unneeded config 2017-08-29 08:36:00 +02:00
vxlan.h lib: VxLAN Network Identifier definition 2017-05-25 10:20:03 -07:00
wheel.c *: Convert list_delete(struct list *) to ** to allow nulling 2017-10-05 10:53:13 -04:00
wheel.h *: reindent 2017-07-17 14:04:07 +02:00
workqueue.c lib: Free workqueue memory leak on free 2017-10-11 10:00:54 -04:00
workqueue.h lib: cleanup the work queue implementation 2017-08-17 17:47:07 +02:00
zassert.h *: Remove cvs control points 2017-12-05 17:28:12 -05:00
zclient.c Merge pull request #1665 from donaldsharp/nexthop_labels 2018-01-23 19:09:08 -05:00
zclient.h Merge pull request #1665 from donaldsharp/nexthop_labels 2018-01-23 19:09:08 -05:00
zebra.h lib: increase vrf_id from 16 bit to 32 bit identifier 2018-01-22 13:52:17 +01:00