From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 62C6D4924B for ; Thu, 6 Jun 2024 14:24:21 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 8DF7868D6D4; Thu, 6 Jun 2024 17:24:19 +0300 (EEST) Received: from relay5-d.mail.gandi.net (relay5-d.mail.gandi.net [217.70.183.197]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 49A8568D545 for ; Thu, 6 Jun 2024 17:24:13 +0300 (EEST) Received: by mail.gandi.net (Postfix) with ESMTPSA id 72DD31C000E for ; Thu, 6 Jun 2024 14:24:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=niedermayer.cc; s=gm1; t=1717683852; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=AEyLYmqABC35cSxlU5747f4KLotVjLOhi6nkw5/6HDk=; b=auFG/Tu4TW4azo3HQw02nsmuZUrw8b+xD+VDsQXl4EuK6lyp+x4ZWZCn/qm+/Jz+T2Y6JD bSk1DDjKwCesAAI+GCJIvz1SMCauzVQiuEI5PsWx1K2UOfBf3AmJCRG6OhQg1fgbuB3RqS FBJYFCKMwv85+uDWTTaBkvkp+eld/6DtxoW/qOnbov32syN+jP698N/Q3WFURnYPUSJYNt Rwv7Kdn7i6LOHTBk22khXJNLWm/L17yOZ+TIDU1NL8DY+oHvGQkkD2iF5M0W9SzGx1vDpP YmlB8yxCgCtP0dX53O266Y8WPESjKAMxkWf61XQ5rpBMqe8Sxrdu/amkPZzjUA== Date: Thu, 6 Jun 2024 16:24:11 +0200 From: Michael Niedermayer To: FFmpeg development discussions and patches Message-ID: <20240606142411.GO2821752@pb2> References: <20240605131808.282394-1-ffmpeg-devel@pileofstuff.org> <20240605231748.GM2821752@pb2> MIME-Version: 1.0 In-Reply-To: X-GND-Sasl: michael@niedermayer.cc Subject: Re: [FFmpeg-devel] [PATCH] lavu/opt: Mention that AVOptions is not reentrant X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: multipart/mixed; boundary="===============3650536133035158008==" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --===============3650536133035158008== Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="pSb/ns2SnWJqkKHb" Content-Disposition: inline --pSb/ns2SnWJqkKHb Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Jun 06, 2024 at 09:29:24AM +0100, Andrew Sayers wrote: > On Thu, Jun 06, 2024 at 01:17:48AM +0200, Michael Niedermayer wrote: > [...] > > AVOption simply provides light weight access to the struct fields. > > Calling AVOption non re-entrant in modifying a field you arent even all= owed > > to modify from 2 threads is confusing >=20 > I think you're saying there's already a rule about modifying AVOptions fr= om > 2 threads. Could you explain that in more detail? Well, one way this can be argued is this: Latest C draft: (but i doubt this is different) ISO/IEC 9899:2017 C17 bal= lot N2176 "Two expression evaluations conflict if one of them modifies a memory locat= ion and the other one reads or modifies the same memory location" so if you have 2 threads and one writes into a int and another reads it at = the same time, the code is broken. The code doing said act through some API doesnt become less broken Calling AVOption non re-rentrant because of that is false thats as if one e= xecuted strtok_r(a,b,c) with the VERY same a,b,c from 2 threads and then said its not thread safe strtok_r() is thread safe and reentrant if its used correctly, so is AVOpti= on >=20 > > If you want to modify a field from 2 threads that field could be some s= ort > > of atomic type. This can then easily be added to AVOption >=20 > Doing that for a single option would involve publicly guaranteeing its > representation for at least one major version. A feature can be added at any time without a major version bump adding an option that uses a atomic type can thus also be done at any time It can be possible to transparenntly change the underlaying representation under an AVOption without ABI break but that requires some thought and care thx [...] --=20 Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB It is a danger to trust the dream we wish for rather than the science we have, -- Dr. Kenneth Brown --pSb/ns2SnWJqkKHb Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iF0EABEKAB0WIQSf8hKLFH72cwut8TNhHseHBAsPqwUCZmHGhAAKCRBhHseHBAsP q3h6AJ0SsOJd7FTqFhArjDBjlYk0WjAOHQCgl0T7t96mjka5KaQ0R0VBP7pt5i0= =iWEM -----END PGP SIGNATURE----- --pSb/ns2SnWJqkKHb-- --===============3650536133035158008== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe". --===============3650536133035158008==--