473,500 Members | 1,712 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

MultiThreading?

Hi,

How can I make a sub to be executed only one at the time in a multithreaded
environment?

Eg, I have "server" thread,s that does printing, problem is when several
server threads running at the same time, the Crystal Reports Com Object
crashes, Guess its not thread safe..

How can I change so my "PrintReport" sub only run one at the time, if
another thread is requried to use it, it need to wait until the first is
done.

( I see how I can do it with a global boolean and some do while loops, but
is there any built in functionallity for this kind of operations?)

- Fredrik
Nov 21 '05 #1
2 949
Frederik,

The only thing from this article is that I know that it exist.
(I did not need it)

http://msdn.microsoft.com/library/de...ronization.asp

I hope this helps?

Cor
"Fredrik Melin" <me*@no-spam.dacsa-remove-this.net>
Hi,

How can I make a sub to be executed only one at the time in a
multithreaded environment?

Eg, I have "server" thread,s that does printing, problem is when several
server threads running at the same time, the Crystal Reports Com Object
crashes, Guess its not thread safe..

How can I change so my "PrintReport" sub only run one at the time, if
another thread is requried to use it, it need to wait until the first is
done.

( I see how I can do it with a global boolean and some do while loops, but
is there any built in functionallity for this kind of operations?)

- Fredrik

Nov 21 '05 #2
Use SyncLock Statement
Private Sub PrintReport()
SyncLock "PrintReport"
'Printing
End SyncLock
End Sub

"Fredrik Melin" wrote:
Hi,

How can I make a sub to be executed only one at the time in a multithreaded
environment?

Eg, I have "server" thread,s that does printing, problem is when several
server threads running at the same time, the Crystal Reports Com Object
crashes, Guess its not thread safe..

How can I change so my "PrintReport" sub only run one at the time, if
another thread is requried to use it, it need to wait until the first is
done.

( I see how I can do it with a global boolean and some do while loops, but
is there any built in functionallity for this kind of operations?)

- Fredrik

Nov 21 '05 #3

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

Similar topics

1
2015
by: dixp | last post by:
I'm new to writing multithreaded apps and I have a design question. I have a winforms app and a class which has a method that does processing which is time intensive. I want the user to be able...
47
3682
by: mihai | last post by:
What does the standard say about those two? Is any assurance that the use of STL is thread safe? Have a nice day, Mihai.
16
8466
by: Robert Zurer | last post by:
Can anyone suggest the best book or part of a book on this subject. I'm looking for an in-depth treatment with examples in C# TIA Robert Zurer robert@zurer.com
5
2115
by: sarge | last post by:
I would like to know how to perform simple multithreading. I had created a simple form to test out if I was multithreading properly, but got buggy results. Sometime the whole thig would lock up...
9
2439
by: tommy | last post by:
hi, i have found a example for multithreading and asp.net http://www.fawcette.com/vsm/2002_11/magazine/features/chester/ i want to speed up my website ... if my website is starting, they...
2
2294
by: Rich | last post by:
Hello, I have set up a multithreading routine in a Test VB.net proj, and it appears to be working OK in debug mode and I am not using synchronization. Multithreading is a new thing for me, and...
55
3252
by: Sam | last post by:
Hi, I have a serious issue using multithreading. A sample application showing my issue can be downloaded here: http://graphicsxp.free.fr/WindowsApplication11.zip The problem is that I need to...
5
2472
by: sandy82 | last post by:
Whats actuallly multithreading is ... and how threading and multithreading differ . Can any1 guide how multithreading is used on the Web .. i mean a practical scenario in which u use...
2
2239
by: Pradnya Patil | last post by:
hi , I am trying to draw ' html div-tag ' on the screen which will resemble a rectangle through vb.net code. I want it to be drawn faster...so I introduced multithreading using Threadpool. I...
7
16282
by: Ray | last post by:
Hello, Greetings! I'm looking for a solid C++ multithreading book. Can you recommend one? I don't think I've seen a multithreading C++ book that everybody thinks is good (like Effective C++ or...
0
7136
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
7018
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
7182
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
6906
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5490
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
4923
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4611
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3110
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
316
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.