Re: Question on win32 semaphore simulation

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: Question on win32 semaphore simulation
Date: 2006-04-19 05:20:08
Message-ID: 22215.1145424008@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

"Qingqing Zhou" <zhouqq(at)cs(dot)toronto(dot)edu> writes:
> (2) the killer function is PGSemaphoreReset(). There is no direct function
> for this in Win32 either.

If you can do PGSemaphoreTryLock, then Reset need only be a loop around
it (cf. posix_sema.c). In current usage Reset doesn't have to be very
efficient at all, because it's only used during backend startup to bring
the semaphore to a known state.

> (1) semctl(SETVAL, val=0) - there is no other "val" than zero is used;

Really? Better look again.

If you think the SysV interface is baroque (which I don't disagree
with), then you should just get rid of it entirely and implement
pg_sema.h directly atop the Windows primitives. I don't have a lot of
sympathy for "let's implement just part of SysV because I don't like
that other part". There is no contract saying that sysv_sema.c might
not start using SysV features it doesn't use today.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message energumen@buaa.edu.cn 2006-04-19 06:58:21 Re: how can i get the binary format of timestamp?
Previous Message Qingqing Zhou 2006-04-19 04:00:45 Re: Question on win32 semaphore simulation

Browse pgsql-patches by date

  From Date Subject
Next Message Dhanaraj M 2006-04-19 07:24:54 Patch for #2391: "Similar to" pattern matching does not operate as documented
Previous Message Qingqing Zhou 2006-04-19 04:00:45 Re: Question on win32 semaphore simulation