[Plugin] MultiThread
#16

I tried using this plugin but I can't get it working stable.

This is the pawn code that I'm using (guided by the example):
pawn Код:
public TimFunc2()
{
    #if defined _use_threading
    thTruckerCheck = CreateThread("TruckerCheck");
    #else
    SetTimer("TruckerCheck", 1000, 1);
    #endif
    return 1;
}

// in onplayerconnect
stock AdaugaPThread(playerid)
{
    new lock2 = LockThread(thTruckerCheck);
    Itter_Add(Player, playerid);
    UnLockThread(lock2);
}

// in onplayerdisconnect
stock StergePThread(playerid)
{
    new lock2 = LockThread(thTruckerCheck);
    Itter_Remove(Player, playerid);
    UnLockThread(lock2);
}
#endif

#if defined _use_threading
function TruckerCheck(threadid)
{
    static dTruckerCheck;
    if (!dTruckerCheck)
    {
        dTruckerCheck = true;
        SleepThread(5000);
    } else SleepThread(1020);
    new lock = LockThread(threadid);
#else
function TruckerCheck()
{
#endif
    static s_tmpST;
    s_tmpST = GetTickCount();
    foreach(Player, playerid)
    {
        if(gSofer[playerid])
        {
            if(PlayerIsStreamed(s_tmpST,playerid))
            {
                static s_stringTRK[128], Float:s_cHealth, tmpcar;
                tmpcar = GetPlayerVehicleID(playerid);
                if(tmpcar)
                {
                    GetVehicleHealth(tmpcar, s_cHealth);
                    VehHealthBar(playerid,s_cHealth);
                    if(CarInfo[tmpcar][cModel] == 456 || CarInfo[tmpcar][cModel] == 440)
                    {
                        for(new i=0; i<=NumarBizuri; i++)
                        {
                            if(IsPlayerInRangeOfPoint(playerid, 10.0, BizzInfo[i][bEntranceX], BizzInfo[i][bEntranceY], BizzInfo[i][bEntranceZ]))
                            {
                                format(s_stringTRK, sizeof(s_stringTRK), "~w~%s~n~~r~Products Required~w~: %d~n~~y~Price per Product: ~w~: $%d~n~~g~Funds: ~w~: $%d",BizzInfo[i][bMessage],(BizzInfo[i][bMaxProducts]-BizzInfo[i][bProducts]),BizzInfo[i][bPriceProd],BizzInfo[i][bTill]);
                                GameTextForPlayer(playerid, s_stringTRK, 5000, 3);
                            }
                        }
                    }
                }
            }
        }
    }
    #if defined _use_threading
    UnLockThread(lock);
    #endif
    return 1;
}

This is the backtrace log:
Код:
Thread 10 (Thread 0xb23fbb90 (LWP 14012)):
#0  0xb7fe37f2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
No symbol table info available.
#1  0xb7fc6ef2 in pthread_cond_timedwait@@GLIBC_2.3.2 () from /lib/libpthread.so.0
No symbol table info available.
#2  0xb63965f5 in boost::condition_variable::timed_wait (this=0xb4c4ddc8, m=..., wait_until=...) at ../../../boost/thread/pthread/condition_variable.hpp:64
        guard = {m = 0xb23fb224}
        check_for_interruption = {thread_info = 0xb4c4dd38, m = 0xb4c4ddc8, set = true}
        timeout = {tv_sec = 1309003835, tv_nsec = 153699000}
        cond_res = -1237759302
        __PRETTY_FUNCTION__ = "bool boost::condition_variable::timed_wait(boost::unique_lock<boost::mutex>&, const boost::system_time&)"
#3  0xb638fb0c in boost::this_thread::sleep (st=...) at ../src/pthread/thread.cpp:327
        lk = {m = 0xb4c4ddb0, is_locked = false}
        thread_info = 0xb4c4dd38
#4  0xb6389e46 in Natives::n_SleepThread(tagAMX*, int*) () from plugins/Thread.so

#25 0xb6394afc in boost::pthread::pthread_mutex_scoped_lock::pthread_mutex_scoped_lock(._12 *) (this=0x8934cd8, m_=0xa5)
    at ../../../boost/thread/pthread/pthread_mutex_scoped_lock.hpp:26
No locals.
Backtrace stopped: previous frame inner to this frame (corrupt stack?)
Could this be because I'm also using a mysql plugin with threading and there are conflicts? because I also get this:
Код:
Thread 3 (Thread 0xb6ebfb90 (LWP 13960)):
#0  0xb7fe37f2 in _dl_sysinfo_int80 () from /lib/ld-linux.so.2
No symbol table info available.
#1  0xb7dd7d26 in nanosleep () from /lib/libc.so.6
No symbol table info available.
#2  0xb7e1188c in usleep () from /lib/libc.so.6
No symbol table info available.
#3  0xb7bfd4b7 in ProcessQueryThread (lpParam=0x0) at main.cpp:189
and "ProcessQueryThread" is a function from BlueG's mysql plugin.
Reply


Messages In This Thread
MultiThread - by Fro1sha - 25.06.2011, 06:15
Re: MultiThread - by linuxthefish - 25.06.2011, 06:50
Re: MultiThread - by Fro1sha - 25.06.2011, 06:59
Re: MultiThread - by linuxthefish - 25.06.2011, 07:02
Re: MultiThread - by Ronaldo_raul™ - 25.06.2011, 07:35
Re: MultiThread - by Rysoku - 25.06.2011, 07:45
Re: MultiThread - by Fro1sha - 25.06.2011, 07:51
Re: MultiThread - by langricr - 25.06.2011, 07:58
Re: MultiThread - by Fro1sha - 25.06.2011, 08:18
Re: MultiThread - by langricr - 25.06.2011, 08:23
Re: MultiThread - by Fro1sha - 25.06.2011, 08:29
Re: MultiThread - by Double-O-Seven - 25.06.2011, 19:59
Re: MultiThread - by Fro1sha - 26.06.2011, 06:45
Re: MultiThread - by langricr - 26.06.2011, 07:13
Re: MultiThread - by Incognito - 26.06.2011, 07:55
Re: MultiThread - by xxmitsu - 26.06.2011, 09:08
Re: MultiThread - by Gamer_Z - 26.06.2011, 10:30
Re: MultiThread - by xxmitsu - 26.06.2011, 11:03
Re: MultiThread - by Macluawn - 26.06.2011, 11:31
Re: MultiThread - by Omega-300 - 26.06.2011, 17:54
Re: MultiThread - by Gamer_Z - 27.06.2011, 00:34
Re: MultiThread - by Fro1sha - 27.06.2011, 05:48
Re: MultiThread - by Double-O-Seven - 27.06.2011, 07:44
Re: MultiThread - by ToToRo - 27.06.2011, 12:32
Re: MultiThread - by Gamer_Z - 28.06.2011, 23:47
Re: MultiThread - by Fro1sha - 29.06.2011, 04:23
Re: MultiThread - by Gamer_Z - 30.06.2011, 19:32
Re: MultiThread - by Kyosaur - 30.06.2011, 22:52
Re: MultiThread - by Gamer_Z - 30.06.2011, 23:07
Re: MultiThread - by leong124 - 01.07.2011, 03:35
Re: MultiThread - by Gamer_Z - 01.07.2011, 10:55
Re: MultiThread - by Incognito - 01.07.2011, 12:38
Re: MultiThread - by Gamer_Z - 01.07.2011, 15:09
Re: MultiThread - by leong124 - 02.07.2011, 03:59
Re: MultiThread - by langricr - 02.07.2011, 10:33
Re: MultiThread - by Gamer_Z - 04.07.2011, 00:34
Re: MultiThread - by Fro1sha - 04.07.2011, 06:23
Re: MultiThread - by Gamer_Z - 04.07.2011, 08:32
Re: MultiThread - by Fro1sha - 04.07.2011, 12:23
Re: MultiThread - by jameskmonger - 04.07.2011, 12:36
Re: MultiThread - by Fro1sha - 04.07.2011, 16:31
Re: MultiThread - by jameskmonger - 04.07.2011, 16:35
Re: MultiThread - by jameskmonger - 04.07.2011, 16:38
Re: MultiThread - by QuaTTrO - 19.08.2011, 11:57
Re: MultiThread - by Nanory - 19.08.2011, 17:07
Re: MultiThread - by Kaperstone - 19.08.2011, 17:37
Re: MultiThread - by Zh3r0 - 19.08.2011, 18:16
Re: MultiThread - by Kaperstone - 19.08.2011, 19:01
Re: MultiThread - by AndreT - 19.08.2011, 19:05
Re: MultiThread - by zgintasz - 13.12.2012, 19:55
Re: MultiThread - by Gamer_Z - 14.12.2012, 06:16
Re: MultiThread - by zgintasz - 14.12.2012, 07:26
Re: MultiThread - by P3ti - 24.04.2013, 21:28
Re: MultiThread - by Cameryn - 24.04.2013, 23:38
Re: MultiThread - by Pottus - 25.04.2013, 00:34
Re: MultiThread - by Dan.. - 25.04.2013, 11:58
Re: MultiThread - by Emre__ - 29.01.2014, 16:32
Re: MultiThread - by QuaTTrO - 29.01.2014, 16:39
Re: MultiThread - by [FSaF]Jarno - 29.01.2014, 16:40
Re: MultiThread - by Cypen - 29.01.2014, 17:13
Re: MultiThread - by AirKite - 28.05.2014, 12:43

Forum Jump:


Users browsing this thread: 1 Guest(s)