Re: parallel restore vs. windows

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: parallel restore vs. windows
Дата
Msg-id 493DDF7D.6010503@dunslane.net
обсуждение исходный текст
Ответ на Re: parallel restore vs. windows  (Andrew Chernow <ac@esilo.com>)
Ответы Re: parallel restore vs. windows  (Andrew Chernow <ac@esilo.com>)
Список pgsql-hackers

Andrew Chernow wrote:
> Andrew Dunstan wrote:
>>
>> OK, after quite some trying I have hit a brick wall. I have been 
>> unable to get parallel restore to work with Windows threading. No 
>> doubt I am missing something, but I really don't know what. Unless 
>> someone can tell me what I am doing wrong, I have these possibilities:
>>
>>    * run parallel steps on Windows in separate processes rather than
>>      threads, similar to what we do in the server, or
>>    * disable parallel restore on Windows for now.
>>
>>
>> Time is unfortunately running very short.
>>
>> Latest attempt is attached.
>>
>>
>
> We use _beginthread.  I don't remember exactely how it broke, but it 
> did.  Try using the below instead of CreateThread.
>
> // NOTE: if you don't need the returned handle, close it or
> // leaks will occur.  Closing it doesn't kill the thread.
> HANDLE h = (HANDLE)_beginthreadex(NULL, 0, thread_start, arg, 0, NULL);

This didn't give me any more joy, unfortunately. But you're right, I 
should be using it.

> if(h)
>   CloseHandle(h);

Umm, even if I wait on the handle using waitForMultipleObjects() ?

>
> From MSDN:
> "A thread in an executable that calls the C run-time library (CRT) 
> should use the _beginthread and _endthread functions for thread 
> management rather than CreateThread and ExitThread;"

I am terminating the thread by returning from the thread function. I 
understand this is the recommended way.

cheers

andrew




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

Предыдущее
От: "Fujii Masao"
Дата:
Сообщение: Re: Synchronous replication: sleeping
Следующее
От: Andrew Chernow
Дата:
Сообщение: Re: parallel restore vs. windows