WaitForSingleObject на дескрипторе файла?

Завершено с использованием приведенного ниже кода для заголовков панели, и атрибут style больше не добавляется в заголовок панели расширения.

<div slot="header">
    <h3>{{acl.module_name}}</h3>
</div>

Не уверен, почему использование шаблона добавляет атрибут style в моем случае

<template v-slot:header>
    <div>
        <h3>{{acl.module_name}}</h3>
    </div>
</template>
15
задан user2428118 17 February 2017 в 10:42
поделиться

2 ответа

Don't do it. As you can see, it has undefined behavior.

Even when the behavior is defined, it's defined in such a way as to be relatively not useful unless you don't like writing additional code. It is signaled when any asynchronous I/O operation on that handle completes, which does not generalize to tracking which I/O operation finished.

Why are you trying to wait on a file handle? Clearly the intent matters when you are doing something that isn't even supported well enough to not block indefinitely.

8
ответ дан 1 December 2019 в 04:27
поделиться

I found the following links. The concensus seems to me, don't do it.

Waiting on a file handle

When an I/O operation is started on an asynchronous handle, the handle goes into a non-signaled state. Therefore, when used in the context of a WaitForSingleObject or WaitForMultipleObjects operation, the file handle will become signaled when the I/O operation completes. However, Microsoft actively discourages this technique; it does not generalize if there exists more than one pending I/O operation; the handle would become signaled if any I/O operation completed. Therefore, although this technique is feasible, it is not considered best practice.

Use ReadDirectoryChangesW in overlapped mode. WaitForSingleObject can wait on the event in the OVERLAPPED struct.

You can also use the API WaitForSingleObject() to wait on a file change if you use the following change notification function:
FindFirstChangeNotification()
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/fs/findfirstchangenotification.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/waitforsingleobject.asp

An interesting note on "evilness" of ReadDirectoryChangesW:
http://blogs.msdn.com/ericgu/archive/2005/10/07/478396.aspx

7
ответ дан 1 December 2019 в 04:27
поделиться
Другие вопросы по тегам:

Похожие вопросы: