- * This function indicates that all children (and children's children etc)
- * should use the allocators set up wth talloc_external_enable() rather than
- * normal malloc/free.
- */
-void talloc_mark_external(void *ptr);
+ * If talloc is actually dealing with shared memory (threads or shared
+ * memory using talloc_add_external()) then locking is required on
+ * allocation and free to avoid corruption.
+ *
+ * These hooks allow a very course-grained locking scheme: @lock is
+ * called before any internal alloc or free, and @unlock is called
+ * after. */
+#define talloc_locksafe(lock, unlock, data) \
+ _talloc_locksafe(typesafe_cb(void, lock, data), \
+ typesafe_cb(void, unlock, data), \
+ data)