Author Topic: Creating Threads  (Read 1039 times)

0 Members and 1 Guest are viewing this topic.

Offline eNoVa

  • Major(1)
  • Posts: 6
Creating Threads
« on: February 03, 2008, 09:14:54 am »
Hi all
May you know that problem of functions like geturl...the server is waiting until the result is not faced.
MY questions now are:

How to create Threads ?
How to controll and synchronize them?
How can i get, gained information, from a running Thread?
Are there API-specific things i´ve to know?

I'm thankfull of every kind of information


Date Posted: February 03, 2008, 07:54:54 am
OK
I tested a bit around and now I'm able to answer few questions, i posted before

----------------
How to create Threads ? - Threadfunc ( [Parameter], 'procedure/function-name' );
----------------

Offline sai`ke

  • Camper
  • ***
  • Posts: 318
  • Can't be arsed to remove christmas avatar
Re: Creating Threads
« Reply #1 on: February 03, 2008, 10:10:40 am »
The soldat server is not thread safe. It is not wise to use threadfunc for anything if you don't want your scripts to crash.
#soldat.ttw #ttw.gather --- Quakenet!
http://ttwforums.com

Offline eNoVa

  • Major(1)
  • Posts: 6
Re: Creating Threads
« Reply #2 on: February 04, 2008, 07:48:17 pm »
Hi
i added threadfunc in my script and tested it out...
Up to now i have had no crashes,it works very well, but i faced one thing...it seem not to call everytime(seldom, but significant) my procedures/functions.

One question left, how can i check it , does threadfunc give a value back?

Offline EnEsCe

  • Retired Soldat Developer
  • Flamebow Warrior
  • ******
  • Posts: 3101
  • http://enesce.com/
    • [eC] Official Website
Re: Creating Threads
« Reply #3 on: February 04, 2008, 11:21:20 pm »
Threads can never return a value.

Offline DorkeyDear

  • Veteran
  • *****
  • Posts: 1507
  • I also go by Curt or menturi
Re: Creating Threads
« Reply #4 on: February 05, 2008, 06:30:42 am »
Unfortunately, threads are very limited in Soldat Server scripting; so the only thing related to threads is ThreadFunc which has no return value (no need if there is nothing else to do with threads)
I would guess that in other programming languages, calling a function threaded would return the thread Id number, which then there may be other functions to manage/gather information about the thread; but not here..

Offline eNoVa

  • Major(1)
  • Posts: 6
Re: Creating Threads
« Reply #5 on: February 07, 2008, 06:18:02 pm »
Thank you for that fast replay.
So i reckon, there´s no Possibility to synchronize threads, are they ?
I think i have to resign oneself... geturl connected with PHP and MYSQL with live-actualisation is too UN-preformant.
Have you ever tryed to  script a mysql-class or something in that way  ?

Date Posted: February 05, 2008, 08:18:40 am
OK
today it happened...
My server crashed like you have predicted...
I was absence so i dont really know what happened...
I post the error-log may its usefull for you...

==================================================

<Player> could not respond
[Error] <scriptname> -> <threadedprocedure>: Access violation at address 7C921629 in module 'ntdll.dll'
  • Chat Abort

Server Encountered an error:

Shutting down server...
{
 comment: since this crash geturl does not work correctly
[Error] <scriptname> -> <activateserver>: HTTP/1.1 404 Not Found
And yes, the page is avalible...
}
==================================================


in my Threaded procedure is only called a geturl procedure and only one threaded-procedure is(/should) running.

BTW could it be that geturl gives a value back not till the page has been loaded fully and there is no time-limit?
I mean, maybe you know, sometimes a page hangs up and you can wait and wait and the page will never be loaded?
I just wanted to ask, maybe the error occured because too much simultaneous threads were runnning?
« Last Edit: February 07, 2008, 06:40:35 pm by eNoVa »