Raised This Month: $51 Target: $400
 12% 

Function synchronization


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
peenut
Member
Join Date: Nov 2013
Old 04-29-2017 , 11:51   Function synchronization
Reply With Quote #1

I'm pretty new to sourcepawn, but i have a question about how functions run in order.

If i have this code
PHP Code:
int someInt[64]

loadArrays()

void loadArrays() {
    
clearArray();
    
writeArray();
}

void clearArray() {
    for (
int i 064i++) {
        
someInt[i] = 0;
    }
}

void writeArray() {
    for (
int i 064i++) {
        
someInt[i] = i;
    }

Will clearArray() be read synchronous with writeArray(), or will writeArray() run after clearArray() ?

Last edited by peenut; 04-29-2017 at 11:52.
peenut is offline
Timocop
AlliedModders Donor
Join Date: Mar 2013
Location: Germany
Old 04-29-2017 , 12:43   Re: Function synchronization
Reply With Quote #2

Basicly Top to Bottom, like every language. writeArray() will run after clearArray()

Timocop is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 04-29-2017 , 12:43   Re: Function synchronization
Reply With Quote #3

SourcePawn is single threaded so everything is synchronous (no chance for race condition)
__________________
WildCard65 is offline
peenut
Member
Join Date: Nov 2013
Old 04-29-2017 , 13:05   Re: Function synchronization
Reply With Quote #4

Cool, thank you very much!
peenut is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 17:17.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode