Re: Question on win32 semaphore simulation - Mailing list pgsql-hackers

From Qingqing Zhou
Subject Re: Question on win32 semaphore simulation
Date
Msg-id e21kqr$c6j$1@news.hub.org
Whole thread Raw
In response to Question on win32 semaphore simulation  ("Qingqing Zhou" <zhouqq@cs.toronto.edu>)
List pgsql-hackers
"Qingqing Zhou" <zhouqq@cs.toronto.edu> wrote
> 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?

Regards,
Qingqing




pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: Is full_page_writes=off safe in conjunction with
Next
From: "energumen@buaa.edu.cn"
Date:
Subject: how can i get the binary format of timestamp?