# Sync

## Summary

| ### Functions ||
|---|---|
| `https://developer.android.com/ndk/reference/group/sync#group___sync_1gae2158ed0a67f008ca7056843363fc11a(int32_t fd)` | `struct sync_file_info *` Retrieve detailed information about a sync file and its fences. |
| `https://developer.android.com/ndk/reference/group/sync#group___sync_1gaedfc944a2b93b36cbd71e5c9299e0efb(struct https://developer.android.com/ndk/reference/group/sync#group___sync_1gae2158ed0a67f008ca7056843363fc11a *info)` | `void` Free a struct sync_file_info structure. |
| `https://developer.android.com/ndk/reference/group/sync#group___sync_1gadb88bc37b7c7588437c33e820acd214d(const struct https://developer.android.com/ndk/reference/group/sync#group___sync_1gae2158ed0a67f008ca7056843363fc11a *info)` | `struct sync_fence_info *` Get the array of fence infos from the sync file's info. |
| `https://developer.android.com/ndk/reference/group/sync#group___sync_1gaacf3feda171ae19eeb29f6dac8faf5bb(const char *name, int32_t fd1, int32_t fd2)` | `int32_t` Merge two sync files. |

## Functions

### sync_file_info

Declared in `android/sync.h`

```scdoc
struct sync_file_info * sync_file_info(
  int32_t fd
)
```
Retrieve detailed information about a sync file and its fences.

The returned sync_file_info must be freed by calling [sync_file_info_free()](https://developer.android.com/ndk/reference/group/sync#group___sync_1gaedfc944a2b93b36cbd71e5c9299e0efb).

Available since API level 26.

### sync_file_info_free

Declared in `android/sync.h`

```scdoc
void sync_file_info_free(
  struct sync_file_info *info
)
```
Free a struct sync_file_info structure.

Available since API level 26.

### sync_get_fence_info

Declared in `android/sync.h`

```gdscript
struct sync_fence_info * sync_get_fence_info(
  const struct sync_file_info *info
)
```
Get the array of fence infos from the sync file's info.

The returned array is owned by the parent sync file info, and has info-\>num_fences entries.

Available since API level 26.

### sync_merge

Declared in `android/sync.h`

```gdscript
int32_t sync_merge(
  const char *name,
  int32_t fd1,
  int32_t fd2
)
```
Merge two sync files.

This produces a new sync file with the given name which has the union of the two original sync file's fences; redundant fences may be removed.

If one of the input sync files is signaled or invalid, then this function may behave like dup(): the new file descriptor refers to the valid/unsignaled sync file with its original name, rather than a new sync file.

The original fences remain valid, and the caller is responsible for closing them.

Available since API level 26.