-
Notifications
You must be signed in to change notification settings - Fork 84
Development (re usage)
Sebastian Reimers edited this page May 15, 2022
·
12 revisions
Preferred order:
- System/Third party headers
- libre headers
- Local/Custom headers
Example
#include <string.h>
#include <re.h>
#include "custom.h"
Within libre itself use the specific headers like re_types.h
etc.
You can #undef
conflicting definitions before libre header include:
#include <sys/queue.h>
#undef LIST_INIT
#undef LIST_FOREACH
#include <re.h>
By default re_main()
is single threaded. You can register multiple worker threads with re_thread_init()
like so:
static int thread_handler(void *arg)
{
re_thread_init();
/* register network/tmr callbacks */
err = re_main(NULL); /* Start new worker eventloop */
re_thread_close();
}
...
thr_t tid;
thrd_create(&tid, thread_handler, NULL);
...
See retest remain.c for a complete example.