Raised This Month: $ Target: $400
 0% 

Are timers threaded?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
dilalmon
AlliedModders Donor
Join Date: Apr 2013
Old 11-17-2015 , 17:48   Are timers threaded?
Reply With Quote #1

This might be a silly question, but are timers seperately threaded from the main plugin thread?

I ask this because I have a timer that sends PrintHintText of a pre-formatted string every 0.1 seconds, but although rare I've seen it some weird texts that were cut-off.

For example, the main plugin would format ("Current Time is %i", GetTime()) occasionally, but the text sent to the clients from the timer would have something like ("Current Ti").
So I was wondering if timers are running separately from the main execution thread.
dilalmon is offline
WildCard65
Veteran Member
Join Date: Aug 2013
Location: Canada
Old 11-17-2015 , 18:06   Re: Are timers threaded?
Reply With Quote #2

From the SM sourcecode they are ran through OnGameFrame hook internal in SM while doing gametime check for you.
WildCard65 is offline
Potato Uno
Veteran Member
Join Date: Jan 2014
Location: Atlanta, Georgia
Old 11-17-2015 , 18:13   Re: Are timers threaded?
Reply With Quote #3

All pawn code runs on a single thread. Furthermore at any time t, either SM bytecode (pawn code) OR valve's srcds code is running on the server (but never both at once).

The entire server is ran single threaded.

Spoiler
Potato Uno is offline
dilalmon
AlliedModders Donor
Join Date: Apr 2013
Old 11-17-2015 , 18:21   Re: Are timers threaded?
Reply With Quote #4

I see. There must be something else I did wrong then.
Thanks.

Last edited by dilalmon; 11-17-2015 at 18:21.
dilalmon is offline
Mitchell
~lick~
Join Date: Mar 2010
Old 11-18-2015 , 09:42   Re: Are timers threaded?
Reply With Quote #5

Quote:
Originally Posted by dilalmon View Post
I've seen it some weird texts that were cut-off.
There is a max length for what text you can put into a usermessage. Might be your issue, but it's not that low of a buffer.

Last edited by Mitchell; 11-18-2015 at 09:43.
Mitchell 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 12:29.


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