From: Roddy, Mark [Mark.Roddy@stratus.com] Sent: Thursday, May 02, 2002 4:16 PM To: NT Developers Interest List Subject: [ntdev] RE: Sharing stack-allocated data between threads I mean that the following is commonplace. THREAD1: foo() { KEVENT event; // on the stack, yes? . . KeInitializeEvent(&event,...); IoSetCompletionRoutine(Irp, fooComplete, &event, ...); IoCallDriver(LowerDevObj, Irp); KeWaitForSingleObject(&event, ...); . . } SOME OTHER THREAD: fooComplete(IN PDEVICE_OBJECT DeviceObject, IN PIRP Irp, IN PVOID Context // this is a pointer to some thread's stack! ) { . . . KeSetEvent((PRKEVENT)Context, ...); . . return STATUS_MORE_PROCESSING_REQUIRED; } > -----Original Message----- > From: int3 [mailto:kssatish@aalayance.com] > Sent: Thursday, May 02, 2002 1:22 PM > To: NT Developers Interest List > Subject: [ntdev] RE: Sharing stack-allocated data between threads > > > Can u explain bit more please. > > ----- Original Message ----- > From: "Roddy, Mark" > To: "NT Developers Interest List" > Sent: Thursday, May 02, 2002 10:32 PM > Subject: [ntdev] RE: Sharing stack-allocated data between threads > > > > Actually it is done frequently. For example, a stack allocated event > object > > may be used as IO completion context. You do have to be > very careful > >that the owning thread's stack is not paged out if the users can be > >running at = DISPATCH_LEVEL. > > > > > > > > -----Original Message----- > > From: int3 [mailto:kssatish@aalayance.com] > > Sent: Thursday, May 02, 2002 12:44 PM > > To: NT Developers Interest List > > Subject: [ntdev] RE: Sharing stack-allocated data between threads > > > > > > No, You cannot - I am sure, u will screw me, if u use my > thread stack > > :-) > > > > ----- Original Message ----- > > From: Chtchetkine, Vladimir > > To: NT Developers Interest List > > Sent: Thursday, May 02, 2002 9:46 PM > > Subject: [ntdev] RE: Sharing stack-allocated data between threads > > > > > > Nope! I'm refering to KM thread stack. > > -----Original Message----- > > From: Paul Bunn [mailto:Paul@UltraBac.com] > > Sent: Thursday, May 02, 2002 8:54 AM > > To: NT Developers Interest List > > Subject: [ntdev] RE: Sharing stack-allocated data between threads > > > > > > I'm assuming you're refering to user-mode. > > Since all memory in a process is shared between all threads of that > process, > > the stacks all share the same process memory so you can > "get at" other > > threads' memory. However, there is the obvious problem that if a > > function returns all its stack data is invalidated and be > overwritten > > by the next stack usage. So, the answer is "yes, if you're very > > careful". Regards Paul Bunn, UltraBac Software, 425-644-6000 > > Microsoft MVP - NT/Windows 2000/XP > > http://www.ultrabac.com > > > > > > -----Original Message----- > > From: Chtchetkine, Vladimir > [mailto:vladimir.chtchetkine@starbase.com] > > Sent: Thursday, > May 02, 2002 7:23 AM > > To: NT Developers Interest List > > Subject: [ntdev] Sharing stack-allocated data between threads > > > > > > Hi everyone! > > It's a kind of paranoid question, but can I share > stack-allocated data > > between different threads? I mean can thread stack be > viewed as "just > > another pool" of memory that is available from all other > > threads? > > Sorry, I guess it's been too much of work and beer yesterday :-) > > --- > > You are currently subscribed to ntdev as: > Vladimir.Chtchetkine@Starbase.com > > To unsubscribe send a blank email to %%email.unsub%% > > --- > > You are currently subscribed to ntdev as: kssatish@aalayance.com To > > unsubscribe send a blank email to %%email.unsub%% > > --- > > You are currently subscribed to ntdev as: Mark.Roddy@stratus.com To > > unsubscribe send a blank email to %%email.unsub%% > > > > --- > > You are currently subscribed to ntdev as: kssatish@aalayance.com To > > unsubscribe send a blank email to %%email.unsub%% > > > > > --- > You are currently subscribed to ntdev as: > Mark.Roddy@stratus.com To unsubscribe send a blank email to > %%email.unsub%% > --- You are currently subscribed to ntdev as: GlennEverhart@FirstUSA.com To unsubscribe send a blank email to leave-ntdev-247T@lists.osr.com