Thread question

Post here your questions about SFS2X. Here we discuss all server-side matters. For client API questions see the dedicated forums.

Moderators: Lapo, Bax

User avatar
Lapo
Site Admin
Posts: 19988
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Thread question

Postby Lapo » 04 Jan 2016, 20:07

You must get rid of the infinite loop!! :D
Scheduled tasks don't need the while(true) block, which by the way forces the thread from the thread pool to never return :shock:

That explains why you have those problems...

Please make sure to check out the example in the documentation, here:
http://docs2x.smartfoxserver.com/Gettin ... wtos#item7
Lapo
--
gotoAndPlay()
...addicted to flash games
User avatar
gabrielvpy
Posts: 54
Joined: 23 Jul 2015, 20:18

Re: Thread question

Postby gabrielvpy » 04 Jan 2016, 20:18

OK. I thought I could have the thread run an infinite loop and just cancel it when something happens. Thanks, lapo.
We made an awesome GPS - MOBA.
Try it out here: Get Fhacktions
User avatar
Lapo
Site Admin
Posts: 19988
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Thread question

Postby Lapo » 04 Jan 2016, 20:24

Yeah ... bad idea :) ... this way you're blocking all threads in the thread pool. Definitely remove it and it will work as expected.

Also make sure to add the try/catch block as explained in the docs, otherwise a runtime exception could stop the task.

cheers
Lapo

--

gotoAndPlay()

...addicted to flash games

Return to “SFS2X Questions”

Who is online

Users browsing this forum: No registered users and 2 guests