Path: news.mitre.org!blanket.mitre.org!philabs!newsjunkie.ans.net!newsfeeds.ans.net!news-was.dfn.de!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!Supernews60!supernews.com!Supernews69!not-for-mail From: "Duane J. McCrory" Newsgroups: comp.os.ms-windows.programmer.nt.kernel-mode Subject: Re: Blocking a user thread in kernel mode Date: Sat, 17 Jan 1998 11:34:47 -0500 Organization: All USENET -- http://www.Supernews.com Lines: 43 Message-ID: <69qn12$1vp$1@usenet50.supernews.com> References: <34BD88D9.2928@spectron.com> NNTP-Posting-Host: 2041@153.35.156.136 X-Newsreader: Microsoft Outlook Express 4.71.1712.3 X-MimeOLE: Produced By Microsoft MimeOLE V4.71.1712.3 If the other thread happens to try an operation using your file handle then all will stop. Open your device multiple times giving each thread its own file handle for accessing your device. This prevents them from blocking one another. Duane. Gilbert Pitney wrote in message <34BD88D9.2928@spectron.com>... >Greetings: > >I am sharing an event object between a user mode application and a high >level device driver for the purpose of awaiting and signaling I/O >completion. However, when a user thread blocks in my driver (by calling >KeWaitForSingleObject), other threads of equal priority in the current >process are not scheduled to run, even though they are ready. > > >In pseudo code, what I am doing is: > >Main User Thread: `Create two threads` > `Wait for thread handles to be signalled` >User Thread 1: hUserEvent = CreateEvent(...); > `Call driver to request I/O, passing hUserEvent down in an IOCTL` >Driver: ObReferenceObjectByHandle(hUserEvent, SYNCHRONIZE, NULL, >KernelMode, &pKevent, NULL); > `Request I/O from the Device` > KeWaitForSingleObject(pKevent, UserRequest, UserMode, FALSE, >`Timeout`); >Device interrupts: ... >Driver DPC: NT_KeSetEvent(pKevent, 0, FALSE); > > >When the Driver blocks User Thread 1 in the KeWaitForSingleObject call, >the other user thread in the current process fails to run until the wait >times out (or the event is signalled by the DPC). > > >Has anyone had a similar experience, or can anyone shed any light? > >Thanks, >- Gil Pitney.