static function vs. multithreaded app.

S

SLEEPY LOLO

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
 
S

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.
 
A

Adie

Victor said:
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
 
A

Alexander Terekhov

SLEEPY said:
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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top