From: | "Magnus Hagander" <mha(at)sollentuna(dot)net> |
---|---|
To: | "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>, <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Question on win32 semaphore simulation |
Date: | 2006-04-18 11:33:15 |
Message-ID: | 6BCB9D8A16AC4241919521715F4D8BCEA352AB@algol.sollentuna.se |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
> > As I reviewed the win32/sema.c, there is some code that I am not
> > clear,
> can
> > anybody explain please?
> >
>
> There is another problem related to concurrent operations on
> win32 sema. Say two processes are doing semop(+1)
> concurrently. Look at this code:
>
> /* Don't want the lock anymore */
> sem_counts[sops[0].sem_num]++;
> ReleaseSemaphore(cur_handle, sops[0].sem_op, NULL);
>
> Except for the problem mentioned in the above thread that the
> first line should be: sem_counts[sops[0].sem_num] +=
> sops[0].sem_op, the sem_counts[] are unprotected by anything,
> so we might lose an update. Maybe I totally misunderstand something?
I've never really looked intot eh semaphore stuff, but if sem_counts[]
is in shared memory it should definitly be protected.
Looking at the code, it looks fairly complex to me. I don't really know
how sysv semaphores are supposed to work, or how we use them, but
perhaps the whole piece of code can be simplified?
//Magnus
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2006-04-18 12:44:32 | Re: Is full_page_writes=off safe in conjunction with |
Previous Message | Hannu Krosing | 2006-04-18 09:27:15 | Re: Is full_page_writes=off safe in conjunction with |