473,327 Members | 2,071 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,327 software developers and data experts.

static function vs. multithreaded app.

Hi!

I have static function and three threads. I would like every thread to use
this function at the same time. Is it possible?
I'm using VC++ under Windows2000.

Thanks

Hubert
Jul 19 '05 #1
3 5297
Victor Bazarov wrote:
"SLEEPY LOLO" <a@aaa.com> wrote...

I have static function and three threads. I would like every thread to use
this function at the same time. Is it possible?


Sure it's possible.

What you should be concerned with is _data_, not _code_.
I think you need a decent book on multithreading to get you
up to speed on concepts like synchronisation, blocking, race
conditions, etc. All of those have really nothing to do with
C++ as a language (the language doesn't have any special
support for multithreading). You probably want to ask in
a newsgroup for your OS or in comp.programming.threads.


Is it just me (who's had a glass or two of wine) or is Victor writing like
he's just burnt the fattest cone this side of Jamaica?

Mellow v i c t o r
Jul 19 '05 #2

SLEEPY LOLO wrote:

Hi!

I have static function and three threads. I would like every thread to use
this function at the same time. Is it possible?
Only if you have "Windows 2000 Server" (4-CPU limit).
I'm using VC++ under Windows2000.


Condolence.

regards,
alexander.
Jul 19 '05 #3
Sin
> I have static function and three threads. I would like every thread to use
this function at the same time. Is it possible?
I'm using VC++ under Windows2000.

This is off-topic here... Try a Microsoft newsgroup.

As for the answer to you question, it's ambigous. A static function is not
different from a normal function (the static keyword doesn't behave the same
way with functions and variables), but a normal function still needs to be
programmed in a way that makes it thread safe.

If for example the function contains static variables, uses global
variables, non-thread-safe functions, etc, you must use synchronization to
avoid problems.

Alex.
Jul 19 '05 #4

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

Similar topics

27
by: Mr. Ed | last post by:
This should be easy, but I can't immediately see what the answer is... I have some code which needs to be re-entrant. It also needs to create a unique identifier. The obvious way to create a...
2
by: Tryion | last post by:
Hi, I'd like to know if it's possible/responsible to use the ReaderWriterLock class (RWL) in a class without declaring it as "static". The example in the SDK does not use a static RWL. However,...
1
by: Ray Ackley | last post by:
I'm experiencing a threading problem that's really perplexing me. I have a multithreaded application that reads car ECU information that's sent over the serial port by the ECU and received by the...
9
by: Clint | last post by:
Hey all - Excuse the cross-post ... I'm not sure what the appropriate newsgroup would be for this question. I have a question that I'm not quite sure how to ask. For all I know, I have the...
11
by: dee | last post by:
OleDbCommand class like many .NET classes has the following description in its help file: "Thread Safety Any public static (Shared in Visual Basic) members of this type are safe for...
2
by: Marcin Kalicinski | last post by:
I'm trying to write platform-independent code that will work correctly in multithreaded environment. I know C++ standard says nothing about threads, but I still think my question is not entirely...
3
by: Charles Nicholson | last post by:
Hello all- I have some static C++ libraries that I wrote in VS2003 but which upgraded fine when i went to VS2005 Pro. In them i overload the global versions of operators new, new, delete, and...
3
by: clqrq | last post by:
i have just a little question: guess i have a class with a static function and i have different threads running. do i have to expect the problem that 2 treads try to acces CA::static() at the...
12
by: sergey.lukoshkin | last post by:
Hello everyone! My task is in converting numbers from string to int variables. I used istringstream to perform it. So I wrote simple test function. But it doesn't work as I expected because...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.