bio
 
Loading...
Searching...
No Matches
Initialization

Initialization and cleanup. More...

Data Structures

struct  bio_linux_options_t
 Initialization options for Linux. More...
 
struct  bio_windows_options_t
 Initialization options for Windows. More...
 
struct  bio_freebsd_options_t
 Initialization options for FreeBSD. More...
 
struct  bio_allocator_t
 Custom memory allocator. More...
 
struct  bio_options_t
 Initialization options. More...
 

Functions

void bio_init (const bio_options_t *options)
 Initialize the framework.
 
void bio_loop (void)
 Enter the event loop until there is no running coroutines.
 
void bio_terminate (void)
 Cleanup.
 
bool bio_is_terminating (void)
 Check whether the calling coroutine is executing inside bio_terminate.
 

Detailed Description

Initialization and cleanup.

A typical program looks like this:

int main(int argc, const char* argv[]) {
// Initialize the library
.log_options = {
.current_filename = __FILE__,
.current_depth_in_project = 1, // If the file is in src/main.c
},
});
// Spawn initial coroutines
bio_spawn(main_coro, data);
// Loop until there is no running coroutines
// Cleanup
return 0;
}
static bio_coro_t bio_spawn(bio_entrypoint_t entrypoint, void *userdata)
Spawn a new coroutine.
Definition bio.h:731
void bio_init(const bio_options_t *options)
Initialize the framework.
void bio_loop(void)
Enter the event loop until there is no running coroutines.
void bio_terminate(void)
Cleanup.
Initialization options.
Definition bio.h:408

Function Documentation

◆ bio_init()

void bio_init ( const bio_options_t options)

Initialize the framework.

◆ bio_is_terminating()

bool bio_is_terminating ( void  )

Check whether the calling coroutine is executing inside bio_terminate.

Daemon coroutines should check this and terminate.

See also
bio_coro_options_t::daemon

◆ bio_loop()

void bio_loop ( void  )

Enter the event loop until there is no running coroutines.

◆ bio_terminate()

void bio_terminate ( void  )

Cleanup.

It will schedule daemon coroutines to run so they can perform cleanup.

Remarks
If the daemon coroutines do not terminate, this function will not return.
See also
bio_is_terminating