---
name: "pvm_barrier"
section: "3"
platform: "linux"
package: "pvm-dev"
version: "3.4.2-8"
release: "Debian 3.0 (Woody)"
platforms: ["linux"]
url: "https://new.carta.tech/pvm_barrier"
---

# pvm\_barrier(3)

Blocks the calling process until all processes in a group have called it.

## NAME

pvm\_barrier - Blocks the calling process until all processes in a group have called it.

## SYNOPSIS

```
C	int info = pvm_barrier( char *group, int count )
Fortran	call pvmfbarrier( group, count, info )
```

## PARAMETERS

- group

  **Character string group name. The group must exist and the** **calling process must be a member of the group.**\

- count

  **Integer specifying the number of group members that must call** **pvm\_barrier before they are all released. Though not required,** **count is expected to be the total number of members of the** **specified group.**\

- info

  **Integer status code returned by the routine.** **Values less than zero indicate an error.**

## DESCRIPTION

**The routine** *pvm\_barrier* **blocks the calling process until** *count* **members of the** *group* **have called pvm\_barrier.** **The count argument is required because processes could be** **joining the given group after other processes have called** **pvm\_barrier. Thus PVM doesn't know how many group members** **to wait for at any given instant. Although count can be set less,** **it is typically the total number of members of the group.** **So the logical function of the pvm\_barrier call** **is to provide a group synchronization.** **During any given barrier call all participating group members** **must call barrier with the same count value.** **Once a given barrier has been successfully passed,** **pvm\_barrier can be called again by the same group using the same** **group name.**

**If pvm\_barrier is successful,** *info* **will be 0. If some error occurs then** *info* **will be \< 0.**

## EXAMPLES

```
C:
	inum = pvm_joingroup( "worker" );
	        .
	        .
	info = pvm_barrier( "worker", 5 );

Fortran:
	CALL PVMFJOINGROUP( "shakers", INUM )
	COUNT = 10
	CALL PVMFBARRIER( "shakers", COUNT, INFO )
```

## ERRORS

**These error conditions can be returned by** *pvm\_barrier*

- PvmSysErr

  **pvmd was not started or has crashed.**

- PvmBadParam

  **giving a count \< 1.**

- PvmNoGroup

  **giving a non-existent group name.**

- PvmNotInGroup

  **calling process is not in specified group.**

## SEE ALSO

**pvm\_joingroup(3PVM)**
