CPG_DISPATCH(3)
π CPG_DISPATCH(3) π
okay bestie, gather round, because we're about to talk about cpg_dispatch from the Corosync Cluster Engine Programmer's Manual. yes THE Corosync. the cluster engine. she's iconic, she's from 2004, and she's still serving.
β¨ NAME β¨
cpg_dispatch β dispatches callbacks from the CPG service π«Ά
β¨ SYNOPSIS β¨
#include <corosync/cpg.h>
int cpg_dispatch(cpg_handle_t handle, cpg_dispatch_t *dispatch_types);
β¨ DESCRIPTION β¨
so like, the cpg_dispatch function is literally the girl who goes and fetches your configuration changes or your messages from the closed process groups API. she's the messenger. the main character. the one who shows up with the tea. π
okay so one thing β each application can have several connections to the CPG API at the same time. no, she's not confused, she's just popular. each application uses the handle argument to uniquely identify which connection is which. it's giving "which group chat am I in rn". π
then there's the dispatch_types argument, which tells her what kind of dispatch to run. the possible types are defined by this structure right here:
typedef enum {
CS_DISPATCH_ONE,
CS_DISPATCH_ALL,
CS_DISPATCH_BLOCKING
} cpg_dispatch_t;
and the dispatch values mean the following, bestie, listen up:
CS_DISPATCH_ONEβ dispatches atleast one callback, and she'll block until that callback is dispatched. one (or more!) callback, and she waits. periodt. πCS_DISPATCH_ALLβ dispatches all the waiting callbacks, and she does not block waiting for any callbacks. she's busy, she's efficient, she's got places to be. β¨CS_DISPATCH_BLOCKINGβ dispatches all callbacks, blocking indefinitely. the way this one works: it's used in a threaded program where you create a thread, and thencpg_dispatch()is called immediately from the created thread to execute callbacks. she will wait forever and she is at peace with that. π§βοΈCS_DISPATCH_ONE_NONBLOCKINGβ dispatches at most one callback. and if there's no pending callback? you getCS_ERR_TRY_AGAINback. not me getting a "try again later" text π
β¨ RETURN VALUE β¨
if everything goes slay, this call returns the CS_OK value. otherwise, an error gets returned. that's it, that's the whole vibe check. π¦
β¨ ERRORS β¨
the errors are undocumented. π
like⦠genuinely. that's all the manual says. the lore is lost. we simply do not know. no cap.
β¨ SEE ALSO β¨
here's the whole bestie list, every single one, no gatekeeping:
cpg_overview(3), cpg_initialize(3), cpg_finalize(3), cpg_fd_get(3),
cpg_dispatch(3), cpg_join(3), cpg_leave(3), cpg_mcast_joined(3),
cpg_membership_get(3) cpg_zcb_alloc(3) cpg_zcb_free(3)
cpg_zcb_mcast_joined(3) cpg_context_get(3) cpg_context_set(3)
cpg_local_get(3)
and the error codes, in their full glory π:
CS_ERR_TRY_AGAINβ Resource temporarily unavailableCS_ERR_INVALID_PARAMβ Invalid argumentCS_ERR_ACCESSβ Permission deniedCS_ERR_LIBRARYβ The connection failedCS_ERR_INTERRUPTβ System call interrupted by a signalCS_ERR_NOT_SUPPORTEDβ The requested protocol/functionality not supportedCS_ERR_MESSAGE_ERRORβ Incorrect auth message receivedCS_ERR_NO_MEMORYβ Not enough memory to complete the requested task
okay that's the whole page, you ate that, go forth and dispatch your callbacks responsibly π
this was brought to you by the corosync Man Page, dated 2004-08-31 β a vintage queen. CPG_DISPATCH(3) out. πβ¨
π¦ where this page comes from
- debian bookworm: libcpg-dev 3.1.7-1+deb12u2 Β· BSD-3-Clause
- debian trixie: libcpg-dev 3.1.9-2+deb13u1 Β· BSD-3-Clause
- epel 9: corosynclib-devel 3.1.10-0.2.el9.1 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.10-3.fc43 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.10-3.fc43 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.9-5.fc43 Β· BSD-3-Clause
- fedora 43: corosynclib-devel 3.1.9-5.fc43 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-4.fc44 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-4.fc44 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-6.fc44 Β· BSD-3-Clause
- fedora 44: corosynclib-devel 3.1.10-6.fc44 Β· BSD-3-Clause
- nixos 26.05: corosync 3.1.9
- nixpkgs unstable: corosync 3.1.9
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- opensuse-leap 16.0: corosync-devel 3.1.9-160000.4.1 Β· BSD-3-Clause
- ubuntu jammy: libcpg-dev 3.1.6-1ubuntu1 Β· BSD-3-Clause
- ubuntu jammy: libcpg-dev 3.1.6-1ubuntu1.2 Β· BSD-3-Clause
- ubuntu noble: libcpg-dev 3.1.7-1ubuntu3 Β· BSD-3-Clause
- ubuntu noble: libcpg-dev 3.1.7-1ubuntu3.2 Β· BSD-3-Clause
- ubuntu questing: libcpg-dev 3.1.9-2ubuntu1
- ubuntu questing: libcpg-dev 3.1.9-2ubuntu1.1
- ubuntu resolute: libcpg-dev 3.1.9-2ubuntu3 Β· BSD-3-Clause
- ubuntu stonking: libcpg-dev 3.1.10-3ubuntu1 Β· BSD-3-Clause
- Copyright (c) 2006 Red Hat, Inc
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms