26.06.2011, 09:08
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):
This is the backtrace log:
Could this be because I'm also using a mysql plugin with threading and there are conflicts? because I also get this:
and "ProcessQueryThread" is a function from BlueG's mysql plugin.
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?)
Код:
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