Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > static function vs. multithreaded app.

Reply
Thread Tools

static function vs. multithreaded app.

 
 
SLEEPY LOLO
Guest
Posts: n/a
 
      06-25-2003
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


 
Reply With Quote
 
 
 
 
Sin
Guest
Posts: n/a
 
      06-25-2003
> 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.


 
Reply With Quote
 
 
 
 
Adie
Guest
Posts: n/a
 
      06-25-2003
Victor Bazarov wrote:
>"SLEEPY LOLO" <(E-Mail Removed)> 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
 
Reply With Quote
 
Alexander Terekhov
Guest
Posts: n/a
 
      06-25-2003

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.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to call a non static function from a static function bhattacharjeesoft@gmail.com C++ 2 08-06-2007 11:03 AM
Can a static function declaration conflict with a non-static declaration? nospam_timur@tabi.org C Programming 4 12-12-2006 10:26 PM
multithreaded calling of static func clqrq@yahoo.de C++ 3 09-28-2006 02:11 PM
static member variable in multithreaded environment nin234@yahoo.com C++ 1 02-23-2005 05:34 PM
Re: Detecting static or non-static member function? Victor Bazarov C++ 0 06-23-2003 09:29 PM



Advertisments