473,386 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Ho can I break up a dll into smaller chunks

Hi,

I use a method of a dll and this method use 3 or 4 seconds to
calculate a result. This method run into a thread. I noticed when I am
runing this method, the other thread cannot be run as long as this
method isn't finished. So the other threads don't run until the method
of the dll is finished, so during this time all my application is
suspended, it is my problem, all my application must be running when
the calculation thread is running.
Is this problem normal? Is there a manner to break up the dll's method
into smaller chunks or something like this to share cpu time with
other threads in my application?

Thanks for an answer.

Fabien Pochon
Nov 17 '05 #1
6 1250

"d_well" <d_****@isuisse.com> wrote in message
news:96**************************@posting.google.c om...
Hi,

I use a method of a dll and this method use 3 or 4 seconds to
calculate a result. This method run into a thread. I noticed when I am
runing this method, the other thread cannot be run as long as this
method isn't finished. So the other threads don't run until the method
of the dll is finished, so during this time all my application is
suspended, it is my problem, all my application must be running when
the calculation thread is running.
Is this problem normal? Is there a manner to break up the dll's method
into smaller chunks or something like this to share cpu time with
other threads in my application?

Thanks for an answer.

Fabien Pochon


As I told you in another thread, you'll should call Sleep at regular
intervals during execution of the method, this way you give the other
thread(s) some time to run.
Mind to post the calc method?

Willy.

Nov 17 '05 #2
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message news:<#t*************@TK2MSFTNGP12.phx.gbl>...
"d_well" <d_****@isuisse.com> wrote in message
news:96**************************@posting.google.c om...
Hi,

I use a method of a dll and this method use 3 or 4 seconds to
calculate a result. This method run into a thread. I noticed when I am
runing this method, the other thread cannot be run as long as this
method isn't finished. So the other threads don't run until the method
of the dll is finished, so during this time all my application is
suspended, it is my problem, all my application must be running when
the calculation thread is running.
Is this problem normal? Is there a manner to break up the dll's method
into smaller chunks or something like this to share cpu time with
other threads in my application?

Thanks for an answer.

Fabien Pochon


As I told you in another thread, you'll should call Sleep at regular
intervals during execution of the method, this way you give the other
thread(s) some time to run.
Mind to post the calc method?

Willy.


It doesn't work because I can't call Sleep during the execution of the
method. During the execution of the method nothing else can be done
before the method return a result and I can't insert Sleep in the
method because it is a dll. I tried to change the ThreadPriority but
nothing change, the dll's method use all the ressources of my process
and blocks the other threads. I have to run my others thread more once
by returned result.
It is stange that I can't execute nothing else during the execution of
the method of the dll.

Fabien Pochon
Nov 17 '05 #3

"d_well" <d_****@isuisse.com> wrote in message
news:96**************************@posting.google.c om...
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:<#t*************@TK2MSFTNGP12.phx.gbl>...
"d_well" <d_****@isuisse.com> wrote in message
news:96**************************@posting.google.c om...
> Hi,
>
> I use a method of a dll and this method use 3 or 4 seconds to
> calculate a result. This method run into a thread. I noticed when I am
> runing this method, the other thread cannot be run as long as this
> method isn't finished. So the other threads don't run until the method
> of the dll is finished, so during this time all my application is
> suspended, it is my problem, all my application must be running when
> the calculation thread is running.
> Is this problem normal? Is there a manner to break up the dll's method
> into smaller chunks or something like this to share cpu time with
> other threads in my application?
>
> Thanks for an answer.
>
> Fabien Pochon


As I told you in another thread, you'll should call Sleep at regular
intervals during execution of the method, this way you give the other
thread(s) some time to run.
Mind to post the calc method?

Willy.


It doesn't work because I can't call Sleep during the execution of the
method. During the execution of the method nothing else can be done
before the method return a result and I can't insert Sleep in the
method because it is a dll. I tried to change the ThreadPriority but
nothing change, the dll's method use all the ressources of my process
and blocks the other threads. I have to run my others thread more once
by returned result.
It is stange that I can't execute nothing else during the execution of
the method of the dll.

Fabien Pochon


What I meant was to insert Sleep() calls IN the calculation method, sure, if
you don't have the source code of the method you are calling you are stuck.
If you are running this on is a single CPU machine and the calculation
method only executes CPU instructions before retuning a result, other
threads have a little chance to get the CPU to run.
I'm still not clear what you expect to do in the other thread(s), can you
describe your scenario a bit more in detail?

Willy.

Nov 17 '05 #4
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message news:<OQ**************@TK2MSFTNGP14.phx.gbl>...
"d_well" <d_****@isuisse.com> wrote in message
news:96**************************@posting.google.c om...
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:<#t*************@TK2MSFTNGP12.phx.gbl>...
"d_well" <d_****@isuisse.com> wrote in message
news:96**************************@posting.google.c om...
> Hi,
>
> I use a method of a dll and this method use 3 or 4 seconds to
> calculate a result. This method run into a thread. I noticed when I am
> runing this method, the other thread cannot be run as long as this
> method isn't finished. So the other threads don't run until the method
> of the dll is finished, so during this time all my application is
> suspended, it is my problem, all my application must be running when
> the calculation thread is running.
> Is this problem normal? Is there a manner to break up the dll's method
> into smaller chunks or something like this to share cpu time with
> other threads in my application?
>
> Thanks for an answer.
>
> Fabien Pochon

As I told you in another thread, you'll should call Sleep at regular
intervals during execution of the method, this way you give the other
thread(s) some time to run.
Mind to post the calc method?

Willy.


It doesn't work because I can't call Sleep during the execution of the
method. During the execution of the method nothing else can be done
before the method return a result and I can't insert Sleep in the
method because it is a dll. I tried to change the ThreadPriority but
nothing change, the dll's method use all the ressources of my process
and blocks the other threads. I have to run my others thread more once
by returned result.
It is stange that I can't execute nothing else during the execution of
the method of the dll.

Fabien Pochon


What I meant was to insert Sleep() calls IN the calculation method, sure, if
you don't have the source code of the method you are calling you are stuck.
If you are running this on is a single CPU machine and the calculation
method only executes CPU instructions before retuning a result, other
threads have a little chance to get the CPU to run.
I'm still not clear what you expect to do in the other thread(s), can you
describe your scenario a bit more in detail?

Willy.

Hi,

I think I found the solution for my problem. I changed the COM
threading for my application, it was [STAThread] and I changed to
[MTAThread]. Now the calculation thread doesn't disturb the other
threads. Can you answer me if this solution is good or not?

Thanks.

Fabien
Nov 17 '05 #5

"d_well" <d_****@isuisse.com> wrote in message

Hi,

I think I found the solution for my problem. I changed the COM
threading for my application, it was [STAThread] and I changed to
[MTAThread]. Now the calculation thread doesn't disturb the other
threads. Can you answer me if this solution is good or not?

Thanks.

Fabien


Well it's the first time you talk about COM, you should have mentioned that
before, that's why I asked about the context you are running in.
If your application is a windows application you must keep the STAThread
attribute set.
If your COM object needs a STA to run in, and I guess it is, you have to
initialize your background thread to enter a STA by setting the thread's
ApartmentState property to STA, like this...
someThread.ApartmentState = ApartmentState.STA;
,before you start the thread.
Note that you better call the COM methods only from this thread, this to
prevent inter-thread marshaling overhead.

Willy.
Nov 17 '05 #6
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message news:<OQ**************@TK2MSFTNGP14.phx.gbl>...
"d_well" <d_****@isuisse.com> wrote in message
news:96**************************@posting.google.c om...
"Willy Denoyette [MVP]" <wi*************@telenet.be> wrote in message
news:<#t*************@TK2MSFTNGP12.phx.gbl>...
"d_well" <d_****@isuisse.com> wrote in message
news:96**************************@posting.google.c om...
> Hi,
>
> I use a method of a dll and this method use 3 or 4 seconds to
> calculate a result. This method run into a thread. I noticed when I am
> runing this method, the other thread cannot be run as long as this
> method isn't finished. So the other threads don't run until the method
> of the dll is finished, so during this time all my application is
> suspended, it is my problem, all my application must be running when
> the calculation thread is running.
> Is this problem normal? Is there a manner to break up the dll's method
> into smaller chunks or something like this to share cpu time with
> other threads in my application?
>
> Thanks for an answer.
>
> Fabien Pochon

As I told you in another thread, you'll should call Sleep at regular
intervals during execution of the method, this way you give the other
thread(s) some time to run.
Mind to post the calc method?

Willy.


It doesn't work because I can't call Sleep during the execution of the
method. During the execution of the method nothing else can be done
before the method return a result and I can't insert Sleep in the
method because it is a dll. I tried to change the ThreadPriority but
nothing change, the dll's method use all the ressources of my process
and blocks the other threads. I have to run my others thread more once
by returned result.
It is stange that I can't execute nothing else during the execution of
the method of the dll.

Fabien Pochon


What I meant was to insert Sleep() calls IN the calculation method, sure, if
you don't have the source code of the method you are calling you are stuck.
If you are running this on is a single CPU machine and the calculation
method only executes CPU instructions before retuning a result, other
threads have a little chance to get the CPU to run.
I'm still not clear what you expect to do in the other thread(s), can you
describe your scenario a bit more in detail?

Willy.

Hi,

I think I found the solution for my problem. I changed the COM
threading for my application, it was [STAThread] and I changed to
[MTAThread]. Now the calculation thread doesn't disturb the other
threads. Can you answer me if this solution is good or not?

Thanks.

Fabien
Nov 17 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
by: Scott Brady Drummonds | last post by:
Hi, everyone, I have a bug in a script of several hundred lines of code that I cannot figure out. I have attempted (unsuccessfully) to duplicate this problem in a smaller script that I can post...
9
by: opt_inf_env | last post by:
Hello, I have the following fragment in my html document: <h2>Text 1</h2> <small>Text 2</small> If I see this fragment with browser I see empty line between text1 and text2. Do you know...
1
by: Neo | last post by:
I am in dire need of a break statement in VB.NET language. I have several pieces of code that would have much cleaner look and much less deeper if/else/endif nests IF VB.NET HAS A BREAK STATEMENT...
22
by: petermichaux | last post by:
Hi, I'm curious about server load and download time if I use one big javascript file or break it into several smaller ones. Which is better? (Please think of this as the first time the scripts...
6
by: David | last post by:
I know that by some reasons... the use of "break;" in java language is not correct, is there any similar problems with c#????
12
by: Katie | last post by:
Hi, I am doing a binaryWrite to allow users to download files. The problem occurs if the file is too big. Some of the files i have are close to 100 megs. I read on msdn that if the data is...
1
by: JayDog | last post by:
I have a large data file that I split into smaller more manageable chunks (went from a 12.86 GB file to 500 MB - 1.6 GB chunks). I now want to add to the PERL script and go back through those more...
4
by: coldy | last post by:
Hi, I have a large txt file (1GB) which I need to break into smaller files based on the contents of a column in the file. The values in the column of intrest starts low, then increases, then...
2
by: Nexus6 | last post by:
How might one go about breaking a 64 bit variable into ever smaller chunks of data? First eight 1 byte variables, from there sixteen 1 nibble variables, down to bits. Is it even possible? A pointer...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.