> ## Documentation Index
> Fetch the complete documentation index at: https://dragonwingdocs-staging.qualcomm.com/llms.txt
> Use this file to discover all available pages before exploring further.

# osal signal

## Functions

### `ar_osal_signal_init`

initialize a signal object.

The client must allocate the memory for the signal and pass the pointer to this function. The signal object is initially cleared.

@datatypes ar\_osal\_signal\_t

```cpp theme={null}
int32_t ar_osal_signal_init(ar_osal_signal_t signal)
```

**Parameters**

<ParamField path="signal" type="ar_osal_signal_t">
  Pointer to the signal object.
</ParamField>

**Returns**

0  Success Nonzero  Failure

### `ar_osal_signal_deinit`

De-initialize a signal object.

@datatypes ar\_osal\_signal\_t

```cpp theme={null}
int32_t ar_osal_signal_deinit(ar_osal_signal_t signal)
```

**Parameters**

<ParamField path="signal" type="ar_osal_signal_t">
  Pointer to the signal.
</ParamField>

**Returns**

0  Success Nonzero  Failure

### `ar_osal_signal_get_size`

Get signal object size for client to allocate its memory.

@datatypes ar\_osal\_signal\_t

```cpp theme={null}
size_t ar_osal_signal_get_size(void)
```

**Returns**

Size of signal object

### `ar_osal_signal_create`

Create a signal and initialize.

Signal object memory is allocated by this API and returned to the client. The signal object is initially cleared. ar\_osal\_signal\_create() or ar\_osal\_signal\_init() would be used, but not both.

@datatypes ar\_osal\_signal\_t

```cpp theme={null}
int32_t ar_osal_signal_create(ar_osal_signal_t *signal)
```

**Parameters**

<ParamField path="signal" type="ar_osal_signal_t *">
  Pointer to the signal.
</ParamField>

**Returns**

0  Success Nonzero  Failure

### `ar_osal_signal_destroy`

Destroy a signal.

Frees the memory allocated by ar\_osal\_signal\_create API. Signal objects must not be destroyed while its still in use.

@datatypes ar\_osal\_signal\_t

```cpp theme={null}
int32_t ar_osal_signal_destroy(ar_osal_signal_t signal)
```

**Parameters**

<ParamField path="signal" type="ar_osal_signal_t">
  Pointer to the signal.
</ParamField>

**Returns**

0  Success Nonzero  Failure

### `ar_osal_signal_set`

Sets signal in the specified signal object.

@datatypes ar\_osal\_signal\_t

```cpp theme={null}
int32_t ar_osal_signal_set(ar_osal_signal_t signal)
```

**Parameters**

<ParamField path="signal" type="ar_osal_signal_t">
  Pointer to the signal.
</ParamField>

**Returns**

0  Success Nonzero  Failure

### `ar_osal_signal_clear`

Clear signal in the specified signal object.

Signal must be explicitly cleared by a thread when it is awakened, the wait operations do not automatically clear it.

Clearing a signal that is already cleared has no effect.

@datatypes ar\_osal\_signal\_t

```cpp theme={null}
int32_t ar_osal_signal_clear(ar_osal_signal_t signal)
```

**Parameters**

<ParamField path="signal" type="ar_osal_signal_t">
  Pointer to the signal.
</ParamField>

**Returns**

0  Success Nonzero  Failure

### `ar_osal_signal_wait`

Wait on a signal, wait infinitely for the signal to be set.

If a thread is waiting on a signal object for signal to be set, and the signal object is set, then the thread is awakened.

The signal can be cleared once the signal is set.

The signal must be manually cleared using the ar\_osal\_signal\_clear function. Any number of waiting threads, or threads that subsequently begin wait operations for the specified signal object, will be released while the signal object's state is signaled.

If a signal is set before a thread is waiting, then it will be returned immediately and the signal must be cleared to avoid unintended behavior

@datatypes ar\_osal\_signal\_t

```cpp theme={null}
int32_t ar_osal_signal_wait(ar_osal_signal_t signal)
```

**Parameters**

<ParamField path="signal" type="ar_osal_signal_t">
  Pointer to the signal.
</ParamField>

**Returns**

0  Success Nonzero  Failure

### `ar_osal_signal_timedwait`

Wait on signal till timeout happens.

The signal can be cleared once the signal is set or timeout occurs.

The signal must be manually cleared using the ar\_osal\_signal\_clear function. Any number of waiting threads, or threads that subsequently begin wait operations for the specified signal object, will be released while the signal object's state is signaled.

If a signal is set before a thread is waiting, then it will be returned immediately and the signal must be cleared to avoid unintended behavior

@datatypes ar\_osal\_signal\_t

```cpp theme={null}
int32_t ar_osal_signal_timedwait(ar_osal_signal_t signal, int64_t timeout_in_nsec)
```

**Parameters**

<ParamField path="signal" type="ar_osal_signal_t">
  Pointer to the signal.
</ParamField>

<ParamField path="timeout_in_nsec" type="int64_t">
  Time to wait in nano seconds
</ParamField>

**Returns**

0  Success Nonzero  Failure

## Type Definitions

### `ar_osal_signal_t`

Signal to be triggered by events, or used to trigger events.

```cpp theme={null}
typedef void * ar_osal_signal_t
```
