wl_signal(3)

πŸ’– wl_signal(3) β€” Library Functions Manual πŸ’–

okay bestie, sit down, hydrate, and let's talk about wl_signal β€” she's a source of a type of observable event. That's the whole name, that's the whole vibe. She's from the Wayland library functions crew and she's here to let you know when stuff happens. periodt.


✨ NAME ✨

wl_signal β€” A source of a type of observable event. that's her 🌈


πŸ¦‹ SYNOPSIS πŸ¦‹

#include <wayland-server-core.h>

πŸ’… Public Member Functions

  • void wl_signal_emit_mutable (struct wl_signal *signal, void *data) β€” the fancy safe emitter, we'll get to her

🌸 Static Public Member Functions

  • static void wl_signal_init (struct wl_signal *signal) β€” set a signal up so she's ready to go
  • static void wl_signal_add (struct wl_signal *signal, struct wl_listener *listener) β€” adopt a listener into the signal's little family
  • static struct wl_listener * wl_signal_get (struct wl_signal *signal, wl_notify_func_t notify) β€” find the listener tied to a specific callback
  • static void wl_signal_emit (struct wl_signal *signal, void *data) β€” fire the signal, ping everybody

πŸŽ€ Data Fields

  • struct wl_list listener_list β€” the guest list πŸ“‹

πŸ‘‘ Detailed Description πŸ‘‘

A source of a type of observable event. (Yes, she says it twice. She's consistent. We love that for her.)

Signals are recognized points where significant events can be observed. Compositors as well as the server can provide signals. Observers are wl_listener's that are added through wl_signal_add. Signals are emitted using wl_signal_emit, which will invoke all listeners until that listener is removed by wl_list_remove() (or whenever the signal is destroyed).

fr fr, "until that listener is removed" is doing a LOT of heavy lifting in that sentence, bestie. Read it twice. πŸ’€

See also wl_listener for more information on using wl_signal β€” go read her page too, she's iconic πŸ’œ


🌟 Member Function Documentation 🌟

πŸ“ void wl_signal_add (struct wl_signal * signal, struct wl_listener * listener) [inline], [static]

Add the specified listener to this signal. Welcome to the group chat, you're in it now. 🫢

Parameters

  • signal β€” The signal that will emit events to the listener
  • listener β€” The listener to add

🧚 void wl_signal_emit (struct wl_signal * signal, void * data) [inline], [static]

Emits this signal, notifying all registered listeners. Everybody gets the notification, no one gets left on read. ✨

Parameters

  • signal β€” The signal object that will emit the signal
  • data β€” The data that will be emitted with the signal

πŸ”₯ void wl_signal_emit_mutable (struct wl_signal * signal, void * data)

Emits this signal, notifying all registered listeners. Same energy as her sister above, but she's built different.

A safer version of wl_signal_emit() which can gracefully handle additions and deletions of any signal listener from within listener notification callbacks. gracefully is the keyword. She does not panic. She is unbothered. πŸ’…

Listeners deleted during a signal emission and which have not already been notified at the time of deletion are not notified by that emission.

Listeners added (or readded) during signal emission are ignored by that emission.

⚠️ Note that repurposing a listener without explicitly removing it and readding it is not supported and can lead to unexpected behavior. Not me warning you and you doing it anyway 😭

Parameters

  • signal β€” The signal object that will emit the signal
  • data β€” The data that will be emitted with the signal

Since 1.20.90


πŸ’œ struct wl_listener * wl_signal_get (struct wl_signal * signal, wl_notify_func_t notify) [inline], [static]

Gets the listener struct for the specified callback. Basically a "where is she" search for one specific listener. πŸ”

Parameters

  • signal β€” The signal that contains the specified listener
  • notify β€” The listener that is the target of this search

Returns the list item that corresponds to the specified listener, or NULL if none was found


🌈 void wl_signal_init (struct wl_signal * signal) [inline], [static]

Initialize a new wl_signal for use. Glow-up complete, she's ready to be deployed. πŸŽ€

Parameters

  • signal β€” The signal that will be initialized

🌸 Field Documentation 🌸

struct wl_list wl_signal::listener_list

That's the list of listeners. That's the whole field. That's it. That's the note. πŸ¦‹


⭐ Author ⭐

Generated automatically by Doxygen for Wayland from the source code. (not a human, but honestly? she ate. no notes.)


and that's the page, bestie πŸ’– this was wl_signal(3) from Wayland, Version 1.26.0 β€” go forth, emit your signals, treat your listeners with respect, and remember: always remove before you repurpose. mwah 🫢✨