---
name: "cpg_leave"
section: "3"
platform: "linux"
package: "libcpg-dev"
version: "3.1.9-2+deb13u1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/cpg_leave"
---

# cpg\_leave(3)

Leave a group in the CPG library

## NAME

cpg\_leave - Leave a group in the CPG library

## SYNOPSIS

**#include \<corosync/cpg.h\>**

**int cpg\_leave(cpg\_handle\_t** *handle***, struct cpg\_name \****group***);**

## DESCRIPTION

The **cpg\_leave** function is used to leave a group.  Once a group has been left the process will no longer receive messages or notifications about events in that group. Note that a process is only deemed to have left the group once it has been notified (by its confchg callback) that is has left. So expect to receive at least one confchg callback after calling this function.

The argument *group* is used to specify the group to leave. It is currently ignored as only one group can be joined per handle. It is included here for to allow for future development.

## RETURN VALUE

This call returns the CS\_OK value if successful, otherwise an error is returned.

## ERRORS

The errors are undocumented.

## SEE ALSO

[**cpg\_overview**(3)](/cpg_overview/3.md), [**cpg\_initialize**(3)](/cpg_initialize/3.md), [**cpg\_finalize**(3)](/cpg_finalize/3.md), [**cpg\_fd\_get**(3)](/cpg_fd_get/3.md), [**cpg\_dispatch**(3)](/cpg_dispatch/3.md), [**cpg\_join**(3)](/cpg_join/3.md), [**cpg\_leave**(3)](/cpg_leave/3.md), [**cpg\_mcast\_joined**(3)](/cpg_mcast_joined/3.md), [**cpg\_membership\_get**(3)](/cpg_membership_get/3.md) [**cpg\_zcb\_alloc**(3)](/cpg_zcb_alloc/3.md) [**cpg\_zcb\_free**(3)](/cpg_zcb_free/3.md) [**cpg\_zcb\_mcast\_joined**(3)](/cpg_zcb_mcast_joined/3.md) [**cpg\_context\_get**(3)](/cpg_context_get/3.md) [**cpg\_context\_set**(3)](/cpg_context_set/3.md) [**cpg\_local\_get**(3)](/cpg_local_get/3.md)

**CS\_ERR\_TRY\_AGAIN** Resource temporarily unavailable

**CS\_ERR\_INVALID\_PARAM** Invalid argument

**CS\_ERR\_ACCESS** Permission denied

**CS\_ERR\_LIBRARY** The connection failed

**CS\_ERR\_INTERRUPT** System call interrupted by a signal

**CS\_ERR\_NOT\_SUPPORTED** The requested protocol/functionality not supported

**CS\_ERR\_MESSAGE\_ERROR** Incorrect auth message received

**CS\_ERR\_NO\_MEMORY** Not enough memory to complete the requested task
