@@ -335,9 +335,12 @@ int LY_VCODE_INSTREXP_len(const char *str);
335335 *****************************************************************************/
336336
337337/**
338- * @brief Private context data.
338+ * @brief Private run-time context data.
339339 *
340- * Run-time data for a context, used by the library internally.
340+ * The data is thread and context address specific. It is used to store
341+ * thread-specific data related to the context.
342+ *
343+ * No synchronization is needed for this data, it is only accessed by the thread that created it.
341344 */
342345struct ly_ctx_private_data {
343346 const struct ly_ctx * ctx ; /**< context to which this data belongs */
@@ -347,9 +350,12 @@ struct ly_ctx_private_data {
347350};
348351
349352/**
350- * @brief Shared context data.
353+ * @brief Shared run-time context data.
354+ *
355+ * It is used to store data that can be shared between multiple threads
356+ * using the same context address, e.g. printed contexts created from the same memory address.
351357 *
352- * The data is shared only when using printed contexts that are created from the same memory address .
358+ * Members need to be protected by locks .
353359 */
354360struct ly_ctx_shared_data {
355361 const struct ly_ctx * ctx ; /**< context to which this data belongs */
@@ -429,7 +435,7 @@ void ly_ctx_data_del(const struct ly_ctx *ctx);
429435 * @brief Get private (thread-specific) context data or create it if it does not exist.
430436 *
431437 * @param[in] ctx Context whose data to get.
432- * @return Context data of @p ctx, NULL if not found .
438+ * @return Context data of @p ctx, NULL on memory allocation failure .
433439 */
434440struct ly_ctx_private_data * ly_ctx_private_data_get_or_create (const struct ly_ctx * ctx );
435441
0 commit comments