MultiThreading GPF when Accessing the DAO 
Author Message
 MultiThreading GPF when Accessing the DAO

Hello,

Platform:     Windows NT WorkStation 4.0, Service Pack 2
Language:     Visual Basic 5 Enterprise, Visual Studio Service Pack 1

I've succeeded in writing a multithreaded ole server using the
CreateThread Win32 API call. I've been tracing the progress of my
application by writing position marking messages to a log file. The
threads run (I can see the main thread ID, and up to three others,
depending on what I am doing). The problem I am encountering is that I
get a GPF as soon as I do anything having to do with the DAO within my
thread. This GPF does not occur immediately, since I get a fair amount
of messages from my other threads before the GPF occurs.

I'm compiling to Native Code, Optimizing for speed. The server is an
ActiveX EXE, with no visible interface. Unattended execution is enabled.
It's using a thread pool of 1 thread. The reason I am using CreateThread
instead of using the threading built into VB (Sincle Thread Per Object
or a Thread Pool) is because I need to be able to share global data
among the threads.

I've looked in the Help, Books OnLine, Knowledge Base. I've called
Microsoft Technical Support, but since MultiThreading is not officially
supported by VB, they can't really help me much at this time. They have
suggested using RDO (to see if it's just the JET Engine) instead, but I
would prefer to avoid this for the moment, as I haven't used the RDO
before, and, at present time doesn't permit a learning curve, especially
for something that might not work.

Thanks In Advance

N Varacalli

--
The views expressed herein do not represent the views of my employer.

The Address in the header is mangled, delete appropriately.

To reach me via e-mail, try
NICHOLAS_VARACALLI at non-hp-Canada-om1.om.hp.com



Sun, 16 Jan 2000 03:00:00 GMT  
 MultiThreading GPF when Accessing the DAO

Quote:
> I've succeeded in writing a multithreaded ole server using the
> CreateThread Win32 API call. I've been tracing the progress of my
> application by writing position marking messages to a log file. The
> threads run (I can see the main thread ID, and up to three others,
> depending on what I am doing). The problem I am encountering is that I
> get a GPF as soon as I do anything having to do with the DAO within my
> thread. This GPF does not occur immediately, since I get a fair amount
> of messages from my other threads before the GPF occurs.

I had the same problem. I was using Access for logging of errors, so both
threads needed to get to the database. The solution was to open the
recordset from the primary thread, (in this case it was a Table object) as
a global variable. Then use a common routine to insert into that table from
either thread. The key seemed to be doing all initialization of DAO from
the primary thread, then using global recordset vars to use the database
from the other threads.
Let me know if this works!


Sun, 16 Jan 2000 03:00:00 GMT  
 MultiThreading GPF when Accessing the DAO

Just a note: if you're accessing globals from both threads, you'll want to
look into the various synchronization APIs to make sure your threads don't
stomp on each other. MSDN has lots of articles on the theory, MSJ has some
examples of their use in VB5 in the last 2 issues (August and September).



Sun, 16 Jan 2000 03:00:00 GMT  
 MultiThreading GPF when Accessing the DAO


Fri, 19 Jun 1992 00:00:00 GMT  
 MultiThreading GPF when Accessing the DAO

Actually, it's my understanding that DAO isn't thread-safe (I believe the
ASP documentation mentions this somewhere). ADO is thread-safe; I'm not
sure about RDO.

-Jon



Quote:
> Hello,

> Platform:     Windows NT WorkStation 4.0, Service Pack 2
> Language:     Visual Basic 5 Enterprise, Visual Studio Service Pack 1

> I've succeeded in writing a multithreaded ole server using the
> CreateThread Win32 API call. I've been tracing the progress of my
> application by writing position marking messages to a log file. The
> threads run (I can see the main thread ID, and up to three others,
> depending on what I am doing). The problem I am encountering is that I
> get a GPF as soon as I do anything having to do with the DAO within my
> thread. This GPF does not occur immediately, since I get a fair amount
> of messages from my other threads before the GPF occurs.
> Thanks In Advance

> N Varacalli

> --
> The views expressed herein do not represent the views of my employer.

> The Address in the header is mangled, delete appropriately.

> To reach me via e-mail, try
> NICHOLAS_VARACALLI at non-hp-Canada-om1.om.hp.com



Sun, 16 Jan 2000 03:00:00 GMT  
 MultiThreading GPF when Accessing the DAO


Fri, 19 Jun 1992 00:00:00 GMT  
 MultiThreading GPF when Accessing the DAO

One should probably consider using Critical Sections.
Do you happen to know if there are any VB samples for that? It seems to be
quite trivial
but I havn't tried it yet.

Alon



Quote:
> Just a note: if you're accessing globals from both threads, you'll want
to
> look into the various synchronization APIs to make sure your threads
don't
> stomp on each other. MSDN has lots of articles on the theory, MSJ has
some
> examples of their use in VB5 in the last 2 issues (August and September).



Mon, 17 Jan 2000 03:00:00 GMT  
 MultiThreading GPF when Accessing the DAO

VB doesnot allow you to create multithreads.
Better create an out of process OLE server and use OLE automation.
(stollen from Appleman's book)


Quote:

>Hello,

>Platform:     Windows NT WorkStation 4.0, Service Pack 2
>Language:     Visual Basic 5 Enterprise, Visual Studio Service Pack 1

>I've succeeded in writing a multithreaded ole server using the
>CreateThread Win32 API call. I've been tracing the progress of my
>application by writing position marking messages to a log file. The
>threads run (I can see the main thread ID, and up to three others,
>depending on what I am doing). The problem I am encountering is that I
>get a GPF as soon as I do anything having to do with the DAO within my
>thread. This GPF does not occur immediately, since I get a fair amount

-----------------
remove every y from my address in order to reply!
enough is enough (or isn't?)


Mon, 17 Jan 2000 03:00:00 GMT  
 MultiThreading GPF when Accessing the DAO

Quote:
>I've succeeded in writing a multithreaded ole server using the
>CreateThread Win32 API call. I've been tracing the progress of my
>application by writing position marking messages to a log file. The
>threads run (I can see the main thread ID, and up to three others,
>depending on what I am doing). The problem I am encountering is that I
>get a GPF as soon as I do anything having to do with the DAO within my
>thread. This GPF does not occur immediately, since I get a fair amount

You might want to look at the July issue of Microsoft System Journal.  There
is an article in there regarding how to do multi-tasking with VB.

Of course,the problems might be that DAO is not reentry -- i.e., does not
support multi-tasking.  Does anyone know for sure?

Richard L Rosenheim



Tue, 18 Jan 2000 03:00:00 GMT  
 MultiThreading GPF when Accessing the DAO

Quote:

> VB doesnot allow you to create multithreads.
> Better create an out of process OLE server and use OLE automation.
> (stollen from Appleman's book)

Sorry, but Microsoft Systems Journal, Visual Basic Programmer's Journal
both have examples of multithreading in VB5. I also have a working
example, as long as I don't touch the DAO.

N Varacalli
--
The views expressed herein do not represent the views of my employer.

The Address in the header is mangled, delete appropriately.

To reach me via e-mail, try
NICHOLAS_VARACALLI at non-hp-Canada-om1.om.hp.com



Tue, 18 Jan 2000 03:00:00 GMT  
 MultiThreading GPF when Accessing the DAO

Check the last 2 Microsoft Journals. I used the CriticaSection class
provided.

Quote:
> One should probably consider using Critical Sections.
> Do you happen to know if there are any VB samples for that? It seems to
be
> quite trivial
> but I havn't tried it yet.

> Alon



Wed, 19 Jan 2000 03:00:00 GMT  
 MultiThreading GPF when Accessing the DAO

Thanks. I will.
--

-------------------------------------
Alon Fleischer
Hilonet Israel Ltd.
8 Tarpab St. Ramat Gan 52110 Israel
Tel: +972-3-6135068   Fax: +972-3-6136718


HTTP:  http://hilonet.com
-------------------------------------



Thu, 20 Jan 2000 03:00:00 GMT  
 MultiThreading GPF when Accessing the DAO

Multithreading DOES work in VB...you will just have to put up with the
GPF's.  No way around it.  Trust me, I've been in touch with MS about
this for a while.  Try it yourself :)

On Fri, 01 Aug 1997 13:56:21 -0400, NV

Quote:


>> VB doesnot allow you to create multithreads.
>> Better create an out of process OLE server and use OLE automation.
>> (stollen from Appleman's book)

>Sorry, but Microsoft Systems Journal, Visual Basic Programmer's Journal
>both have examples of multithreading in VB5. I also have a working
>example, as long as I don't touch the DAO.

>N Varacalli
>--
>The views expressed herein do not represent the views of my employer.

>The Address in the header is mangled, delete appropriately.

>To reach me via e-mail, try
>NICHOLAS_VARACALLI at non-hp-Canada-om1.om.hp.com



Fri, 21 Jan 2000 03:00:00 GMT  
 MultiThreading GPF when Accessing the DAO

Followup:

According to some helpful souls in these newsgroups, and some strong
hints from Microsoft Tech Support, it seems that DAO is not threadsafe.
I'm currently investigating ADO, RDO, and binary files as alternatives.
If anyone has any other suggestions, or wants me to keep them posted,
please e-mail me.

Thanks for the help.

N Varacalli
--
The views expressed herein do not represent the views of my employer.

The Address in the header is mangled, delete appropriately.

To reach me via e-mail, try
NICHOLAS_VARACALLI at non-hp-Canada-om1.om.hp.com



Fri, 21 Jan 2000 03:00:00 GMT  
 MultiThreading GPF when Accessing the DAO

Quote:

> Multithreading DOES work in VB...you will just have to put up with the

> GPF's.  No way around it.  Trust me, I've been in touch with MS about
> this for a while.  Try it yourself :)

I don't understand!  I wrote an app that can process a report, or update
files, while you work on some other data entry.  It uses DAO, it is the
same program, and it hasn't crashed yet!
I found that as long as I open the workspace only once, that everything
works fine.  The ONLY catch is that the msgbox causes EVERYTHING to wait
while waiting for input.  ALSO, you need to sprinkle a few doevents in
there.  BTW, I DO limit file processing to one routine, and one
report(just because I have one progress form), but you can cascape data
entry all over the place!

It works nice, and shocked a few people! 8-)

Steve

Steve



Fri, 21 Jan 2000 03:00:00 GMT  
 
 [ 25 post ]  Go to page: [1] [2]

 Relevant Pages 

1. MultiThreading GPF when Accessing the DAO

2. MultiThreading GPF when Accessing the DAO

3. DAO accessing MDB, GPF upon exiting program

4. Win 3.1 GPF with MS Access DAO

5. DAO 3.5 and multithreading --yes or no?

6. Finding GPF in DAO, Crystal?

7. Finding GPF in DAO, Crystal?

8. GPF when using DAO

9. Multithreading in Access - Is it possible?

10. Access and multithreading...

11. Multithreading Access

12. Application written for Access 2000 with DAO won't run in Access 2002

 

 
Powered by phpBB® Forum Software