[HACKERS] Latches API on windows

Поиск
Список
Период
Сортировка
От Abbas Butt
Тема [HACKERS] Latches API on windows
Дата
Msg-id CALtH27eeooVpAhOLVno4RRk2h97xM=ihj_q3N0K8zADapKPARg@mail.gmail.com
обсуждение исходный текст
Ответы Re: [HACKERS] Latches API on windows  (Craig Ringer <craig@2ndquadrant.com>)
Список pgsql-hackers
Hi,
I am working on a contrib module that uses RegisterDynamicBackgroundWorker API
to create a couple of worker processes. For synchronization between the
background worker processes I am using InitSharedLatch, SetLatch, WaitLatch APIs.
One of the processes is supposed to wait for the latch, the other is supposed to set it.
The system works perfectly fine as long as its run on Linux, however when tried
on Windows, it fails giving the error:
ResetEvent failed: error code 6
Error code 6 means invalid handle. Debugging reveals that the handle contains
a valid value, however it seems that the handle is not accessible (was not created)
in the process that is calling ResetEvent.

Debugging the issue lead me to the following comment on top of InitSharedLatch:

 * InitSharedLatch needs to be called in postmaster before forking child
 * processes, usually right after allocating the shared memory block
 * containing the latch with ShmemInitStruct. (The Unix implementation
 * doesn't actually require that, but the Windows one does.)

In my case this is not true, I am calling InitSharedLatch in _PG_init
which gets called at CREATE EXTENSION time.
My question : Is there a way to get the latches API work on windows
the way it is working on Linux?

Best Regards

--
--
Abbas
Architect
Skype ID: gabbasb
www.enterprisedb.com

Follow us on Twitter

@EnterpriseDB

Visit EnterpriseDB for tutorials, webinars, whitepapers and more

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: [HACKERS] On markers of changed data
Следующее
От: Alexander Korotkov
Дата:
Сообщение: Re: [HACKERS] GSoC 2017 : Patch for predicate locking in Gist index