[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: SIGPROF + SIGCHLD and igc
From: |
Eli Zaretskii |
Subject: |
Re: SIGPROF + SIGCHLD and igc |
Date: |
Sat, 28 Dec 2024 21:00:07 +0200 |
> From: Helmut Eller <eller.helmut@gmail.com>
> Cc: pipcet@protonmail.com, gerd.moellmann@gmail.com, ofv@wanadoo.es,
> emacs-devel@gnu.org, acorallo@gnu.org
> Date: Sat, 28 Dec 2024 19:08:18 +0100
>
> 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); /* <design/check/#.common> */
>
> /* This should be the first claim. Now we own the mutex */
> /* it is ok to check this. */
> AVER(lock->claims == 0);
> lock->claims = 1;
> }
I guess they use PTHREAD_MUTEX_ERRORCHECK to get the error?
Anyway, the MS-Windows implementation uses EnterCriticalSection, which
allows a thread to call it any number of times after the first call
succeeded, so they must be using something else on Windows to detect
multiple locks by the same thread, maybe the count of claims or
something?
>
> > Are we sure MPS must take the lock before it can stop registered
> > threads?
>
> Now that's a question for the MPS mailing list.
Right.
- Re: SIGPROF + SIGCHLD and igc, (continued)
- Re: SIGPROF + SIGCHLD and igc, Gerd Möllmann, 2024/12/27
- Re: SIGPROF + SIGCHLD and igc, Pip Cet, 2024/12/27
- Re: SIGPROF + SIGCHLD and igc, Helmut Eller, 2024/12/27
- Re: SIGPROF + SIGCHLD and igc, Helmut Eller, 2024/12/28
- Re: SIGPROF + SIGCHLD and igc, Eli Zaretskii, 2024/12/28
- Re: SIGPROF + SIGCHLD and igc, Helmut Eller, 2024/12/28
- Re: SIGPROF + SIGCHLD and igc, Eli Zaretskii, 2024/12/28
- Re: SIGPROF + SIGCHLD and igc, Helmut Eller, 2024/12/28
- Re: SIGPROF + SIGCHLD and igc, Eli Zaretskii, 2024/12/28
- Re: SIGPROF + SIGCHLD and igc, Helmut Eller, 2024/12/28
- Re: SIGPROF + SIGCHLD and igc,
Eli Zaretskii <=
- Re: SIGPROF + SIGCHLD and igc, Helmut Eller, 2024/12/28
- Re: SIGPROF + SIGCHLD and igc, Pip Cet, 2024/12/28
- Re: SIGPROF + SIGCHLD and igc, Helmut Eller, 2024/12/28
- Re: SIGPROF + SIGCHLD and igc, Pip Cet, 2024/12/29
- Re: SIGPROF + SIGCHLD and igc, Eli Zaretskii, 2024/12/29
- Re: SIGPROF + SIGCHLD and igc, Pip Cet, 2024/12/29
- Re: SIGPROF + SIGCHLD and igc, Pip Cet, 2024/12/29
- Re: SIGPROF + SIGCHLD and igc, Eli Zaretskii, 2024/12/30
- Re: SIGPROF + SIGCHLD and igc, Pip Cet, 2024/12/30
- Re: SIGPROF + SIGCHLD and igc, Eli Zaretskii, 2024/12/30