---
title: dispatch_set_context
framework: dispatch
role: symbol
role_heading: Function
path: dispatch/dispatch_set_context
---

# dispatch_set_context

Associates an application-defined context with the object.

## Declaration

```occ
extern void dispatch_set_context(dispatch_object_t object, void *context);
```

## Parameters

- `object`: This parameter cannot be NULL.
- `context`: The new application-defined context for the object. This can be NULL.

## Discussion

Discussion Your application can associate custom context data with the object, to be used only by your application. Your application must allocate and deallocate the data as appropriate.

## See Also

### Updating Contextual Data

- [dispatch_get_context](dispatch/dispatch_get_context.md)
