---
name: "cpg_finalize"
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_finalize"
---

# cpg\_finalize(3)

Terminate a connection to the CPG service

## NAME

cpg\_finalize - Terminate a connection to the CPG service

## SYNOPSIS

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

**int cpg\_finalize(cpg\_handle\_t** *handle***);**

## DESCRIPTION

The **cpg\_finalize** function is used to close a connection to the closed process group API. Once the connection is finalized, the handle may not be used again by applications. No more callbacks will be dispatched from the **cpg\_dispatch function.**

## 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
