From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Helmut Eller Newsgroups: gmane.emacs.devel Subject: Re: SIGPROF + SIGCHLD and igc Date: Sat, 28 Dec 2024 19:08:18 +0100 Message-ID: <8734i7of3h.fsf@gmail.com> References: <87o713wwsi.fsf@telefonica.net> <87ttaucub8.fsf@protonmail.com> <87pllicrpi.fsf@protonmail.com> <864j2u442i.fsf@gnu.org> <87a5ch5z1b.fsf@gmail.com> <87plld5pev.fsf@protonmail.com> <87ed1t6r34.fsf@gmail.com> <875xn46s6z.fsf@gmail.com> <86bjwwulnc.fsf@gnu.org> <877c7jlxsu.fsf@gmail.com> <86frm7sx4d.fsf@gnu.org> <87a5cfoivh.fsf@gmail.com> <867c7jsoat.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="11608"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: pipcet@protonmail.com, gerd.moellmann@gmail.com, ofv@wanadoo.es, emacs-devel@gnu.org, acorallo@gnu.org To: Eli Zaretskii Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Sat Dec 28 19:09:20 2024 Return-path: Envelope-to: ged-emacs-devel@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1tRbFX-0002uR-Lq for ged-emacs-devel@m.gmane-mx.org; Sat, 28 Dec 2024 19:09:19 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tRbEm-000618-6m; Sat, 28 Dec 2024 13:08:32 -0500 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tRbEd-00060M-Cr for emacs-devel@gnu.org; Sat, 28 Dec 2024 13:08:24 -0500 Original-Received: from mail-ej1-x62f.google.com ([2a00:1450:4864:20::62f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tRbEb-0001Ik-If; Sat, 28 Dec 2024 13:08:22 -0500 Original-Received: by mail-ej1-x62f.google.com with SMTP id a640c23a62f3a-aaee0b309adso725705466b.3; Sat, 28 Dec 2024 10:08:20 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1735409299; x=1736014099; darn=gnu.org; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=Lwt/EMgHaqWjIO0wh0Is0SWl3mvAQCEvc5a8QwocQ4U=; b=YJsf75E7PjdRJTOREMVjKOn8zOMo8GswsCrgzybiECY3vExw3LRcMzMcXBVtG0BYxe EEkLc7bjM4baedM3AmXIEesEZvFm0n/PR/80uvwbL72RZTwsrNHGr4WE3wGbmvEzQv/J hyijVa0hkv0/EcnJqXk8iN0FVvmROCw7TM2b/QwR/yitJmYCBznSDVeQHenAwATPE89p SVDeF7fCrCwjTn8eyr+W+BhaU51FbObptznZbEnU28K6A5djo8GG4J4V5Ony23UEbuF1 OsR6S3rvU6804U+cr+d4JqRkALL9rsfDSibPvol3TE277KJp0QQ+dD3LTibS2GZso5db wdJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1735409299; x=1736014099; h=mime-version:user-agent:message-id:date:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=Lwt/EMgHaqWjIO0wh0Is0SWl3mvAQCEvc5a8QwocQ4U=; b=trM++7ocaMuhOlJ6DU6H6rYYvXz7CSdafaIQ56wAlUrziHl9hNLCg2o629lxbk4Xpw SYvePe9A9wwI52sH6DnQFcxz3M/JCfyTCA/T+u5nqu0f9WS8B9K0TvjnbZkbqa/WE8+N k7vvbwSkdtgA74gmRYa/EytopY+zYbdlNSkesYDQjt0A6pYsAAnUhHrSSzhO1uzhhlN+ HzxWPVJNbTMKef+M+mKYD+hk44rFsDOvwx+Oc9Qe5b4pQOh+pTRzvVqxbfNsdLEeZQBI RUyfgyUQsS2nGKsNyDCXJk8G7KKTSnsY0HXyoI/Hb6olJ9pjSbmHS+X0rOhIX4JlCKRh z3dw== X-Forwarded-Encrypted: i=1; AJvYcCVAurAROvWiaOD+CTTiW/A4QsgNXXe+FbzrcmU3ybEmLSCxJbiPUahpnyBwDJwsEzRhXVPHC4QN8Sad8YI=@gnu.org, AJvYcCVE8MkppDost5kpSkIhgaHLniBjpsBxy4rKLFcdKPxcnm8gbV/e9nG1M7MHDzCPkqqwaPNBVPj5WQ==@gnu.org X-Gm-Message-State: AOJu0Yy+wZmnzzF9TTpNvh0OW86kO1rfE2A5jNNI0wb/pyY7NUyYyk+y o81jRS74O3/+v7ZwL8vxSY72Lw4li94t6W1M2TfeAZp80sl5vp6hmrdh0fPA X-Gm-Gg: ASbGncvZvz745AayDDtVKDuDPM5bZ6CDvF+MZDNgcECsgDqHP0nCCnoaH/zr97Tbl7n +jKs1h6Pr4QbFbsDxoDaTyAot80sUXMWT2gtl6TFarIfB2LK+Sdz5WsZBs+E84ZvWC28E40kRmK saPKXTe9B85IzQE8X3S+4ZRiasHC5GbePFWse8OMLWMXpJI+YWsOeTRxqzNG9/OJG9bJEy+CgD3 detm1oB+VCVk3VGqQ0wNpGMAlJVQqhvbIxTvwlodFMAnWdsVlNgv48= X-Google-Smtp-Source: AGHT+IGhXBUw3Amo26GWEx2m3wTeOwbdjS7pA4E8m72+XuCvlIwjVSEpNJBG1sHP1if5jdKH+V2ecw== X-Received: by 2002:a17:907:c816:b0:aaf:f32:cd34 with SMTP id a640c23a62f3a-aaf0f32d0afmr1188845266b.15.1735409299062; Sat, 28 Dec 2024 10:08:19 -0800 (PST) Original-Received: from caladan ([31.177.115.143]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aac0e89641asm1270651266b.55.2024.12.28.10.08.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 28 Dec 2024 10:08:18 -0800 (PST) In-Reply-To: <867c7jsoat.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 28 Dec 2024 19:35:54 +0200") Received-SPF: pass client-ip=2a00:1450:4864:20::62f; envelope-from=eller.helmut@gmail.com; helo=mail-ej1-x62f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.devel:327282 Archived-At: On Sat, Dec 28 2024, Eli Zaretskii wrote: >> If two threads are claiming a the same non-recursive lock concurrently, >> then it's not an error. > > Oh, so you are saying that taking the lock twice is a fatal error only > if that is done from the same thread? Is that known for certain? Ahem, now you're making be nervous. I'll show the implementation before I say something stupid: /* LockClaim -- claim a lock (non-recursive) */ void (LockClaim)(Lock lock) { int res; AVERT(Lock, lock); res = pthread_mutex_lock(&lock->mut); /* pthread_mutex_lock will error if we own the lock already. */ AVER(res == 0); /* */ /* This should be the first claim. Now we own the mutex */ /* it is ok to check this. */ AVER(lock->claims == 0); lock->claims = 1; } /* LockClaimRecursive -- claim a lock (recursive) */ void (LockClaimRecursive)(Lock lock) { int res; AVERT(Lock, lock); res = pthread_mutex_lock(&lock->mut); /* pthread_mutex_lock will return: */ /* 0 if we have just claimed the lock */ /* EDEADLK if we own the lock already. */ AVER((res == 0) == (lock->claims == 0)); AVER((res == EDEADLK) == (lock->claims > 0)); ++lock->claims; AVER(lock->claims > 0); } > Are we sure MPS must take the lock before it can stop registered > threads? Now that's a question for the MPS mailing list. Helmut