Re: Question on win32 semaphore simulation

From: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Question on win32 semaphore simulation
Date: 2006-04-18 02:58:14
Message-ID: e21kqr$c6j$1@news.hub.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


"Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Bruce Momjian 2006-04-18 03:40:33 Re: schema-qualified SET CONSTRAINTS
Previous Message Peter Eisentraut 2006-04-17 22:45:27 Re: question regarding pg_database.h and DatabaseRelationId