### Method

# Camel ObjectBag reserve

#### Declaration [src]

    gpointer
    camel_object_bag_reserve (
      CamelObjectBag* bag,
      gconstpointer key
    )

#### Description [src]

Reserves `key` in `bag`. If `key` is already reserved in another thread, then wait until the reservation has been committed.

After reserving `key`, you either get a reference to the object corresponding to `key` (similar to camel_object_bag_get()) or you get `NULL`, signifying that you MUST call either `camel_object_bag_add()` or camel_object_bag_abort().

#### Parameters

`key`

  Type: `gconstpointer`

  The key to reserve.

  The argument can be `NULL`.
  The data is owned by the caller of the method.

#### Return value

Type: `gpointer`

The object for `key`, or `NULL` if `key` is not found.

The caller of the method takes ownership of the returned data, and is responsible for freeing it.
The return value can be `NULL`.