Lely core libraries
2.3.4
|
#include "io2.h"
#include <lely/libc/threads.h>
#include <lely/io2/ctx.h>
#include <lely/util/errnum.h>
#include <lely/util/util.h>
#include <assert.h>
#include <stdlib.h>
Go to the source code of this file.
Data Structures | |
struct | io_ctx |
Functions | |
io_ctx_t * | io_ctx_create (void) |
Creates a new I/O context. More... | |
void | io_ctx_destroy (io_ctx_t *ctx) |
Destroys an I/O context. More... | |
void | io_ctx_insert (io_ctx_t *ctx, struct io_svc *svc) |
Registers an I/O service with an I/O context. More... | |
void | io_ctx_remove (io_ctx_t *ctx, struct io_svc *svc) |
Unregisters an I/O service with an I/O context. More... | |
int | io_ctx_notify_fork (io_ctx_t *ctx, enum io_fork_event e) |
Notifies all registered I/O services of the specified fork event. More... | |
void | io_ctx_shutdown (io_ctx_t *ctx) |
Shuts down all registered I/O services in reverse order of registration. More... | |
This file is part of the I/O library; it contains the implementation of the I/O context functions.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Definition in file ctx.c.
io_ctx_t* io_ctx_create | ( | void | ) |
Creates a new I/O context.
void io_ctx_destroy | ( | io_ctx_t * | ctx | ) |
Registers an I/O service with an I/O context.
Unregisters an I/O service with an I/O context.
This function MUST NOT be invoked while io_ctx_notify_fork() or io_ctx_shutdown() is running.
int io_ctx_notify_fork | ( | io_ctx_t * | ctx, |
enum io_fork_event | e | ||
) |
Notifies all registered I/O services of the specified fork event.
Services are notified in order of registration, unless e is IO_FORK_PREPARE, in which case they are notified in reverse order.
It is the responsibility of the caller to ensure that no services are unregistered while this function is running.
void io_ctx_shutdown | ( | io_ctx_t * | ctx | ) |
Shuts down all registered I/O services in reverse order of registration.
Each service is shut down only once, irrespective of the number of calls to this function.
It is the responsibility of the caller to ensure that no services are unregistered while this function is running.