PC Review


Reply
Thread Tools Rate Thread

Add-in multithreading

 
 
Aleksander Tischenko
Guest
Posts: n/a
 
      19th Oct 2003
Hi guys!
My add-in to MS Outlook during its work create several threads. This add-in
also working under Excel and Word, but only with Outlook I have problems.

I noticed that when Outlook is being unloaded it just kills all working
threads. Because of that my threads does not terminated correctly and I got
AV.

Does anyone experiencied with that?


Aleksandr.


 
Reply With Quote
 
 
 
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      19th Oct 2003
Outlook itsel wouldn't care less about any threads it does not conrol - it
is your reposibility to shut down your threads or wait until they terminate
when Outlook unloads your add-in.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Aleksander Tischenko" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi guys!
> My add-in to MS Outlook during its work create several threads. This

add-in
> also working under Excel and Word, but only with Outlook I have problems.
>
> I noticed that when Outlook is being unloaded it just kills all working
> threads. Because of that my threads does not terminated correctly and I

got
> AV.
>
> Does anyone experiencied with that?
>
>
> Aleksandr.
>
>



 
Reply With Quote
 
Aleksander Tischenko
Guest
Posts: n/a
 
      22nd Oct 2003
Okay, just threads supposed to be destroyed in finalization section (I use
Delphi), and this working in any other office application like Word or
Excel. Additionaly I could not control Add-In unload event because my
product is a third-party control for outlook Add-in.

Anway, my customers fixed that by handing Outlook's OnQuit event.
Thanks!

Alex.


"Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Outlook itsel wouldn't care less about any threads it does not conrol - it
> is your reposibility to shut down your threads or wait until they

terminate
> when Outlook unloads your add-in.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
>
> "Aleksander Tischenko" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Hi guys!
> > My add-in to MS Outlook during its work create several threads. This

> add-in
> > also working under Excel and Word, but only with Outlook I have

problems.
> >
> > I noticed that when Outlook is being unloaded it just kills all working
> > threads. Because of that my threads does not terminated correctly and I

> got
> > AV.
> >
> > Does anyone experiencied with that?
> >
> >
> > Aleksandr.
> >
> >

>
>



 
Reply With Quote
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      22nd Oct 2003
Do not do anything COM related in the initialization or finalization
sections in Delphi. OnQuit event or the destructor is a much better place to
do the cleanup.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Aleksander Tischenko" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Okay, just threads supposed to be destroyed in finalization section (I use
> Delphi), and this working in any other office application like Word or
> Excel. Additionaly I could not control Add-In unload event because my
> product is a third-party control for outlook Add-in.
>
> Anway, my customers fixed that by handing Outlook's OnQuit event.
> Thanks!
>
> Alex.
>
>
> "Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Outlook itsel wouldn't care less about any threads it does not conrol -

it
> > is your reposibility to shut down your threads or wait until they

> terminate
> > when Outlook unloads your add-in.
> >
> > Dmitry Streblechenko (MVP)
> > http://www.dimastr.com/
> > OutlookSpy - Outlook, CDO
> > and MAPI Developer Tool
> >
> >
> > "Aleksander Tischenko" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Hi guys!
> > > My add-in to MS Outlook during its work create several threads. This

> > add-in
> > > also working under Excel and Word, but only with Outlook I have

> problems.
> > >
> > > I noticed that when Outlook is being unloaded it just kills all

working
> > > threads. Because of that my threads does not terminated correctly and

I
> > got
> > > AV.
> > >
> > > Does anyone experiencied with that?
> > >
> > >
> > > Aleksandr.
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Aleksander Tischenko
Guest
Posts: n/a
 
      22nd Oct 2003
Thats very moot point, althought destroying threads are not com-relared
thing. And in any case application will not just kill its threads because
they may allocate important resources, lock devices etc.

Alex.

"Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Do not do anything COM related in the initialization or finalization
> sections in Delphi. OnQuit event or the destructor is a much better place

to
> do the cleanup.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
>
> "Aleksander Tischenko" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Okay, just threads supposed to be destroyed in finalization section (I

use
> > Delphi), and this working in any other office application like Word or
> > Excel. Additionaly I could not control Add-In unload event because my
> > product is a third-party control for outlook Add-in.
> >
> > Anway, my customers fixed that by handing Outlook's OnQuit event.
> > Thanks!
> >
> > Alex.
> >
> >
> > "Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Outlook itsel wouldn't care less about any threads it does not

conrol -
> it
> > > is your reposibility to shut down your threads or wait until they

> > terminate
> > > when Outlook unloads your add-in.
> > >
> > > Dmitry Streblechenko (MVP)
> > > http://www.dimastr.com/
> > > OutlookSpy - Outlook, CDO
> > > and MAPI Developer Tool
> > >
> > >
> > > "Aleksander Tischenko" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > Hi guys!
> > > > My add-in to MS Outlook during its work create several threads. This
> > > add-in
> > > > also working under Excel and Word, but only with Outlook I have

> > problems.
> > > >
> > > > I noticed that when Outlook is being unloaded it just kills all

> working
> > > > threads. Because of that my threads does not terminated correctly

and
> I
> > > got
> > > > AV.
> > > >
> > > > Does anyone experiencied with that?
> > > >
> > > >
> > > > Aleksandr.
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      22nd Oct 2003
Well, when finalization section is executed, the dll is being unloaded and
quite a few things would be better off elsewhere, COM is just one example.
As for the threads, since they are yours, you can devise means to signal the
threads to exit by setting a flag/Win32 event on the main thread and waiting
for the thread to terminate, while the thread could check for the flag/event
every once in a while. If you don't gracefully terminate the threads and
wait for their completion, they will be killed regardless, but they will not
have a chance to exit gracefully.

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Aleksander Tischenko" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> Thats very moot point, althought destroying threads are not com-relared
> thing. And in any case application will not just kill its threads because
> they may allocate important resources, lock devices etc.
>
> Alex.
>
> "Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > Do not do anything COM related in the initialization or finalization
> > sections in Delphi. OnQuit event or the destructor is a much better

place
> to
> > do the cleanup.
> >
> > Dmitry Streblechenko (MVP)
> > http://www.dimastr.com/
> > OutlookSpy - Outlook, CDO
> > and MAPI Developer Tool
> >
> >
> > "Aleksander Tischenko" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Okay, just threads supposed to be destroyed in finalization section (I

> use
> > > Delphi), and this working in any other office application like Word or
> > > Excel. Additionaly I could not control Add-In unload event because my
> > > product is a third-party control for outlook Add-in.
> > >
> > > Anway, my customers fixed that by handing Outlook's OnQuit event.
> > > Thanks!
> > >
> > > Alex.
> > >
> > >
> > > "Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > Outlook itsel wouldn't care less about any threads it does not

> conrol -
> > it
> > > > is your reposibility to shut down your threads or wait until they
> > > terminate
> > > > when Outlook unloads your add-in.
> > > >
> > > > Dmitry Streblechenko (MVP)
> > > > http://www.dimastr.com/
> > > > OutlookSpy - Outlook, CDO
> > > > and MAPI Developer Tool
> > > >
> > > >
> > > > "Aleksander Tischenko" <(E-Mail Removed)> wrote in

message
> > > > news:(E-Mail Removed)...
> > > > > Hi guys!
> > > > > My add-in to MS Outlook during its work create several threads.

This
> > > > add-in
> > > > > also working under Excel and Word, but only with Outlook I have
> > > problems.
> > > > >
> > > > > I noticed that when Outlook is being unloaded it just kills all

> > working
> > > > > threads. Because of that my threads does not terminated correctly

> and
> > I
> > > > got
> > > > > AV.
> > > > >
> > > > > Does anyone experiencied with that?
> > > > >
> > > > >
> > > > > Aleksandr.
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Aleksander Tischenko
Guest
Posts: n/a
 
      22nd Oct 2003
The finalization section contains code which correctly terminates all my
threads. And this code works great in all applications like Word, Excel, any
Delphi-application, but not in Outlook, because all my threads already
killed before this code being executed.

"Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
news:#(E-Mail Removed)...
> Well, when finalization section is executed, the dll is being unloaded and
> quite a few things would be better off elsewhere, COM is just one example.
> As for the threads, since they are yours, you can devise means to signal

the
> threads to exit by setting a flag/Win32 event on the main thread and

waiting
> for the thread to terminate, while the thread could check for the

flag/event
> every once in a while. If you don't gracefully terminate the threads and
> wait for their completion, they will be killed regardless, but they will

not
> have a chance to exit gracefully.
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
>
> "Aleksander Tischenko" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > Thats very moot point, althought destroying threads are not com-relared
> > thing. And in any case application will not just kill its threads

because
> > they may allocate important resources, lock devices etc.
> >
> > Alex.
> >
> > "Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed)...
> > > Do not do anything COM related in the initialization or finalization
> > > sections in Delphi. OnQuit event or the destructor is a much better

> place
> > to
> > > do the cleanup.
> > >
> > > Dmitry Streblechenko (MVP)
> > > http://www.dimastr.com/
> > > OutlookSpy - Outlook, CDO
> > > and MAPI Developer Tool
> > >
> > >
> > > "Aleksander Tischenko" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > Okay, just threads supposed to be destroyed in finalization section

(I
> > use
> > > > Delphi), and this working in any other office application like Word

or
> > > > Excel. Additionaly I could not control Add-In unload event because

my
> > > > product is a third-party control for outlook Add-in.
> > > >
> > > > Anway, my customers fixed that by handing Outlook's OnQuit event.
> > > > Thanks!
> > > >
> > > > Alex.
> > > >
> > > >
> > > > "Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > Outlook itsel wouldn't care less about any threads it does not

> > conrol -
> > > it
> > > > > is your reposibility to shut down your threads or wait until they
> > > > terminate
> > > > > when Outlook unloads your add-in.
> > > > >
> > > > > Dmitry Streblechenko (MVP)
> > > > > http://www.dimastr.com/
> > > > > OutlookSpy - Outlook, CDO
> > > > > and MAPI Developer Tool
> > > > >
> > > > >
> > > > > "Aleksander Tischenko" <(E-Mail Removed)> wrote in

> message
> > > > > news:(E-Mail Removed)...
> > > > > > Hi guys!
> > > > > > My add-in to MS Outlook during its work create several threads.

> This
> > > > > add-in
> > > > > > also working under Excel and Word, but only with Outlook I have
> > > > problems.
> > > > > >
> > > > > > I noticed that when Outlook is being unloaded it just kills all
> > > working
> > > > > > threads. Because of that my threads does not terminated

correctly
> > and
> > > I
> > > > > got
> > > > > > AV.
> > > > > >
> > > > > > Does anyone experiencied with that?
> > > > > >
> > > > > >
> > > > > > Aleksandr.
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Dmitry Streblechenko
Guest
Posts: n/a
 
      22nd Oct 2003
Did you try to move the thread termintion code from the finalization section
to your addin's class destructor?

Dmitry Streblechenko (MVP)
http://www.dimastr.com/
OutlookSpy - Outlook, CDO
and MAPI Developer Tool


"Aleksander Tischenko" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> The finalization section contains code which correctly terminates all my
> threads. And this code works great in all applications like Word, Excel,

any
> Delphi-application, but not in Outlook, because all my threads already
> killed before this code being executed.
>
> "Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
> news:#(E-Mail Removed)...
> > Well, when finalization section is executed, the dll is being unloaded

and
> > quite a few things would be better off elsewhere, COM is just one

example.
> > As for the threads, since they are yours, you can devise means to signal

> the
> > threads to exit by setting a flag/Win32 event on the main thread and

> waiting
> > for the thread to terminate, while the thread could check for the

> flag/event
> > every once in a while. If you don't gracefully terminate the threads and
> > wait for their completion, they will be killed regardless, but they will

> not
> > have a chance to exit gracefully.
> >
> > Dmitry Streblechenko (MVP)
> > http://www.dimastr.com/
> > OutlookSpy - Outlook, CDO
> > and MAPI Developer Tool
> >
> >
> > "Aleksander Tischenko" <(E-Mail Removed)> wrote in message
> > news:%(E-Mail Removed)...
> > > Thats very moot point, althought destroying threads are not

com-relared
> > > thing. And in any case application will not just kill its threads

> because
> > > they may allocate important resources, lock devices etc.
> > >
> > > Alex.
> > >
> > > "Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
> > > news:(E-Mail Removed)...
> > > > Do not do anything COM related in the initialization or finalization
> > > > sections in Delphi. OnQuit event or the destructor is a much better

> > place
> > > to
> > > > do the cleanup.
> > > >
> > > > Dmitry Streblechenko (MVP)
> > > > http://www.dimastr.com/
> > > > OutlookSpy - Outlook, CDO
> > > > and MAPI Developer Tool
> > > >
> > > >
> > > > "Aleksander Tischenko" <(E-Mail Removed)> wrote in

message
> > > > news:(E-Mail Removed)...
> > > > > Okay, just threads supposed to be destroyed in finalization

section
> (I
> > > use
> > > > > Delphi), and this working in any other office application like

Word
> or
> > > > > Excel. Additionaly I could not control Add-In unload event because

> my
> > > > > product is a third-party control for outlook Add-in.
> > > > >
> > > > > Anway, my customers fixed that by handing Outlook's OnQuit event.
> > > > > Thanks!
> > > > >
> > > > > Alex.
> > > > >
> > > > >
> > > > > "Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
> > > > > news:(E-Mail Removed)...
> > > > > > Outlook itsel wouldn't care less about any threads it does not
> > > conrol -
> > > > it
> > > > > > is your reposibility to shut down your threads or wait until

they
> > > > > terminate
> > > > > > when Outlook unloads your add-in.
> > > > > >
> > > > > > Dmitry Streblechenko (MVP)
> > > > > > http://www.dimastr.com/
> > > > > > OutlookSpy - Outlook, CDO
> > > > > > and MAPI Developer Tool
> > > > > >
> > > > > >
> > > > > > "Aleksander Tischenko" <(E-Mail Removed)> wrote in

> > message
> > > > > > news:(E-Mail Removed)...
> > > > > > > Hi guys!
> > > > > > > My add-in to MS Outlook during its work create several

threads.
> > This
> > > > > > add-in
> > > > > > > also working under Excel and Word, but only with Outlook I

have
> > > > > problems.
> > > > > > >
> > > > > > > I noticed that when Outlook is being unloaded it just kills

all
> > > > working
> > > > > > > threads. Because of that my threads does not terminated

> correctly
> > > and
> > > > I
> > > > > > got
> > > > > > > AV.
> > > > > > >
> > > > > > > Does anyone experiencied with that?
> > > > > > >
> > > > > > >
> > > > > > > Aleksandr.
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
Aleksander Tischenko
Guest
Posts: n/a
 
      23rd Oct 2003
Yes, it helps. See my second message

"Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Did you try to move the thread termintion code from the finalization

section
> to your addin's class destructor?
>
> Dmitry Streblechenko (MVP)
> http://www.dimastr.com/
> OutlookSpy - Outlook, CDO
> and MAPI Developer Tool
>
>
> "Aleksander Tischenko" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > The finalization section contains code which correctly terminates all my
> > threads. And this code works great in all applications like Word, Excel,

> any
> > Delphi-application, but not in Outlook, because all my threads already
> > killed before this code being executed.
> >
> > "Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
> > news:#(E-Mail Removed)...
> > > Well, when finalization section is executed, the dll is being unloaded

> and
> > > quite a few things would be better off elsewhere, COM is just one

> example.
> > > As for the threads, since they are yours, you can devise means to

signal
> > the
> > > threads to exit by setting a flag/Win32 event on the main thread and

> > waiting
> > > for the thread to terminate, while the thread could check for the

> > flag/event
> > > every once in a while. If you don't gracefully terminate the threads

and
> > > wait for their completion, they will be killed regardless, but they

will
> > not
> > > have a chance to exit gracefully.
> > >
> > > Dmitry Streblechenko (MVP)
> > > http://www.dimastr.com/
> > > OutlookSpy - Outlook, CDO
> > > and MAPI Developer Tool
> > >
> > >
> > > "Aleksander Tischenko" <(E-Mail Removed)> wrote in message
> > > news:%(E-Mail Removed)...
> > > > Thats very moot point, althought destroying threads are not

> com-relared
> > > > thing. And in any case application will not just kill its threads

> > because
> > > > they may allocate important resources, lock devices etc.
> > > >
> > > > Alex.
> > > >
> > > > "Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
> > > > news:(E-Mail Removed)...
> > > > > Do not do anything COM related in the initialization or

finalization
> > > > > sections in Delphi. OnQuit event or the destructor is a much

better
> > > place
> > > > to
> > > > > do the cleanup.
> > > > >
> > > > > Dmitry Streblechenko (MVP)
> > > > > http://www.dimastr.com/
> > > > > OutlookSpy - Outlook, CDO
> > > > > and MAPI Developer Tool
> > > > >
> > > > >
> > > > > "Aleksander Tischenko" <(E-Mail Removed)> wrote in

> message
> > > > > news:(E-Mail Removed)...
> > > > > > Okay, just threads supposed to be destroyed in finalization

> section
> > (I
> > > > use
> > > > > > Delphi), and this working in any other office application like

> Word
> > or
> > > > > > Excel. Additionaly I could not control Add-In unload event

because
> > my
> > > > > > product is a third-party control for outlook Add-in.
> > > > > >
> > > > > > Anway, my customers fixed that by handing Outlook's OnQuit

event.
> > > > > > Thanks!
> > > > > >
> > > > > > Alex.
> > > > > >
> > > > > >
> > > > > > "Dmitry Streblechenko" <(E-Mail Removed)> wrote in message
> > > > > > news:(E-Mail Removed)...
> > > > > > > Outlook itsel wouldn't care less about any threads it does not
> > > > conrol -
> > > > > it
> > > > > > > is your reposibility to shut down your threads or wait until

> they
> > > > > > terminate
> > > > > > > when Outlook unloads your add-in.
> > > > > > >
> > > > > > > Dmitry Streblechenko (MVP)
> > > > > > > http://www.dimastr.com/
> > > > > > > OutlookSpy - Outlook, CDO
> > > > > > > and MAPI Developer Tool
> > > > > > >
> > > > > > >
> > > > > > > "Aleksander Tischenko" <(E-Mail Removed)> wrote in
> > > message
> > > > > > > news:(E-Mail Removed)...
> > > > > > > > Hi guys!
> > > > > > > > My add-in to MS Outlook during its work create several

> threads.
> > > This
> > > > > > > add-in
> > > > > > > > also working under Excel and Word, but only with Outlook I

> have
> > > > > > problems.
> > > > > > > >
> > > > > > > > I noticed that when Outlook is being unloaded it just kills

> all
> > > > > working
> > > > > > > > threads. Because of that my threads does not terminated

> > correctly
> > > > and
> > > > > I
> > > > > > > got
> > > > > > > > AV.
> > > > > > > >
> > > > > > > > Does anyone experiencied with that?
> > > > > > > >
> > > > > > > >
> > > > > > > > Aleksandr.
> > > > > > > >
> > > > > > > >
> > > > > > >
> > > > > > >
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Multithreading in ASP.NET app??? JV Microsoft ASP .NET 29 22nd Mar 2006 01:55 PM
Multithreading in ASP.NET app??? JV Microsoft Dot NET 28 22nd Mar 2006 01:55 PM
Multithreading in ASP.NET app??? JV Microsoft C# .NET 28 22nd Mar 2006 01:55 PM
Multithreading Hugh Janus Microsoft VB .NET 6 24th Jan 2006 01:22 AM
Multithreading =?ISO-8859-2?Q?Marcin_Sm=F3=B3ka?= Microsoft C# .NET 5 14th Nov 2003 03:23 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:02 AM.