ALSA project - the C library reference
Loading...
Searching...
No Matches
async.c File Reference

Async notification helpers. More...

Functions

int snd_async_add_handler (snd_async_handler_t **handler, int fd, snd_async_callback_t callback, void *private_data)
 Registers an async handler.
 
int snd_async_del_handler (snd_async_handler_t *handler)
 Deletes an async handler.
 
int snd_async_handler_get_signo (snd_async_handler_t *handler)
 Returns the signal number assigned to an async handler.
 
int snd_async_handler_get_fd (snd_async_handler_t *handler)
 Returns the file descriptor assigned to an async handler.
 
void * snd_async_handler_get_callback_private (snd_async_handler_t *handler)
 Returns the private data assigned to an async handler.
 

Detailed Description

Async notification helpers.

Author
Abramo Bagnara abram.nosp@m.o@al.nosp@m.sa-pr.nosp@m.ojec.nosp@m.t.org
Date
2001

Function Documentation

◆ snd_async_add_handler()

int snd_async_add_handler ( snd_async_handler_t ** handler,
int fd,
snd_async_callback_t callback,
void * private_data )

Registers an async handler.

Parameters
handlerThe function puts the pointer to the new async handler object at the address specified by handler.
fdThe file descriptor to be associated with the callback.
callbackThe async callback function.
private_dataPrivate data for the async callback function.
Returns
Zero if successful, otherwise a negative error code.

This function associates the callback function with the given file, and saves this association in a snd_async_handler_t object.

Whenever the SIGIO signal is raised for the file fd, the callback function will be called with its parameter pointing to the async handler object returned by this function.

The ALSA sigaction handler for the SIGIO signal automatically multiplexes the notifications to the registered async callbacks. However, the application is responsible for instructing the device driver to generate the SIGIO signal.

The SIGIO signal may have been replaced with another signal, see snd_async_handler_get_signo.

When the async handler isn't needed anymore, you must delete it with snd_async_del_handler.

See also
snd_async_add_pcm_handler, snd_async_add_ctl_handler

◆ snd_async_del_handler()

int snd_async_del_handler ( snd_async_handler_t * handler)

Deletes an async handler.

Parameters
handlerHandle of the async handler to delete.
Returns
Zero if successful, otherwise a negative error code.

◆ snd_async_handler_get_callback_private()

void * snd_async_handler_get_callback_private ( snd_async_handler_t * handler)

Returns the private data assigned to an async handler.

Parameters
handlerHandle to an async handler.
Returns
The private_data value registered with the async handler.
Examples
/test/pcm.c, and /test/timer.c.

◆ snd_async_handler_get_fd()

int snd_async_handler_get_fd ( snd_async_handler_t * handler)

Returns the file descriptor assigned to an async handler.

Parameters
handlerHandle to an async handler.
Returns
The file descriptor if successful, otherwise a negative error code.

◆ snd_async_handler_get_signo()

int snd_async_handler_get_signo ( snd_async_handler_t * handler)

Returns the signal number assigned to an async handler.

Parameters
handlerHandle to an async handler.
Returns
The signal number if successful, otherwise a negative error code.

The signal number for async handlers usually is SIGIO, but wizards can redefine it to a realtime signal when compiling the ALSA library.