Lely core libraries 2.3.4
handle.h File Reference

This is the internal header file of the I/O handle declarations. More...

#include "io.h"
#include <lely/libc/stdatomic.h>
#include <lely/libc/threads.h>
Include dependency graph for handle.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  io_handle
 An I/O device handle. More...
 
struct  io_handle_vtab
 The virtual table of an I/O device handle. More...
 

Functions

struct io_handleio_handle_alloc (const struct io_handle_vtab *vtab)
 Allocates a new I/O device handle from a virtual table.
 
void io_handle_free (struct io_handle *handle)
 Frees an I/O device handle.
 
void io_handle_fini (struct io_handle *handle)
 Finalizes an I/O device handle by invoking its fini method, if available.
 
void io_handle_destroy (struct io_handle *handle)
 Destroys an I/O device handle.
 
void io_handle_lock (struct io_handle *handle)
 Locks an unlocked I/O device handle, so the flags (and other device-specific fields) can safely be accessed.
 
void io_handle_unlock (struct io_handle *handle)
 Unlocks a locked I/O device handle.
 

Detailed Description

This is the internal header file of the I/O handle declarations.

Author
J. S. Seldenthuis jseld.nosp@m.enth.nosp@m.uis@l.nosp@m.ely..nosp@m.com

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 handle.h.

Function Documentation

◆ io_handle_alloc()

struct io_handle * io_handle_alloc ( const struct io_handle_vtab vtab)

Allocates a new I/O device handle from a virtual table.

On success, the reference count is initialized to zero.

Returns
a pointer to a new device handle, or NULL on error.
See also
io_handle_free().

Definition at line 81 of file handle.c.

◆ io_handle_free()

void io_handle_free ( struct io_handle handle)

Frees an I/O device handle.

See also
io_handle_alloc()

Definition at line 120 of file handle.c.

◆ io_handle_destroy()

void io_handle_destroy ( struct io_handle handle)

Destroys an I/O device handle.

This function SHOULD never be called directly. Call io_handle_release() instead.

Definition at line 132 of file handle.c.

◆ io_handle_lock()

void io_handle_lock ( struct io_handle handle)

Locks an unlocked I/O device handle, so the flags (and other device-specific fields) can safely be accessed.

See also
io_handle_unlock()

Definition at line 143 of file handle.c.

◆ io_handle_unlock()

void io_handle_unlock ( struct io_handle handle)

Unlocks a locked I/O device handle.

See also
io_handle_lock()

Definition at line 151 of file handle.c.