cond_init

Initializes a specified condition variable.

Library:LibC
Classification:UNIX International
Service:Synchronization

Syntax

  #include <synch.h>
   
  int   cond_init  (
     cond_t   *cvp,
     int       type,
     int       arg );
  

Parameters

cvp

(IN) Points to the condition variable to be initialized.

type

(IN) Specifies the type of condition variable with one of the following flags:

Flag

Value

Description

USYNC_THREAD

0

The condition variable is known only to the owning process.

USYNC_PROCESS

1

Unsupported. The contition variable can be shared between processes.

arg

(IN) Reserved for future use. Set to 0.

Return Values

If successful, returns zero; otherwise, returns a nonzero error code:

Decimal

Constant

Description

79

ENOTSUP

The type parameter specifies an invalid flag.

Remarks

Condition variables can be used to support event-based synchronization where a lock or a semaphore might not be appropriate.

If you call cond_init on a previously initialized condition variable, no warning is given unless you are in DEBUG mode.

See Also