Alexandros Frantzis | 8b6daa4 | 2020-07-09 13:20:19 +0300 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright 2018 Simon Ser |
| 3 | * Copyright 2021 Collabora, Ltd. |
| 4 | * |
| 5 | * Permission is hereby granted, free of charge, to any person obtaining |
| 6 | * a copy of this software and associated documentation files (the |
| 7 | * "Software"), to deal in the Software without restriction, including |
| 8 | * without limitation the rights to use, copy, modify, merge, publish, |
| 9 | * distribute, sublicense, and/or sell copies of the Software, and to |
| 10 | * permit persons to whom the Software is furnished to do so, subject to |
| 11 | * the following conditions: |
| 12 | * |
| 13 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
| 14 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
| 15 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
| 16 | * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS |
| 17 | * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
| 18 | * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 19 | * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 20 | * SOFTWARE. |
| 21 | */ |
| 22 | |
| 23 | #ifndef WESTON_SIGNAL_H |
| 24 | #define WESTON_SIGNAL_H |
| 25 | |
| 26 | #include <wayland-server-core.h> |
| 27 | |
| 28 | #ifdef __cplusplus |
| 29 | extern "C" { |
| 30 | #endif |
| 31 | |
| 32 | /* A safer version of wl_signal_emit() which can gracefully handle additions |
| 33 | * and deletions of any signal listener from within listener notification |
| 34 | * callbacks. |
| 35 | * |
| 36 | * Listeners deleted during a signal emission and which have not already been |
| 37 | * notified at the time of deletion are not notified by that emission. |
| 38 | * |
| 39 | * Listeners added (or readded) during signal emission are ignored by that |
| 40 | * emission. |
| 41 | * |
| 42 | * Note that repurposing a listener without explicitly removing it and readding |
| 43 | * it is not supported and can lead to unexpected behavior. |
| 44 | */ |
| 45 | |
| 46 | void |
| 47 | weston_signal_emit_mutable(struct wl_signal *signal, void *data); |
| 48 | |
| 49 | #ifdef __cplusplus |
| 50 | } |
| 51 | #endif |
| 52 | |
| 53 | #endif /* WESTON_SIGNAL_H */ |