Mark F
March 7th, 2005, 09:57 AM
I've been trying to use the thread object methods :getthreadpriority() and :setthreadpriority() described in the latest G4A8MT2 distribution help file. I'm not having any luck with either one.
:getthreadpriority() doesn't appear to return anything (nil)
:getthreadpriority() appears to require an undocumented input value (number)
:setthreadpriority() doesn't appear to change the priority (checked in a debugger)
:setthreadpriority() doesn't appear to return the previous priority
Before you ask, the spawned thread is NOT exiting before the calls are made. :)
Here is code that shows most of these problems:
local function printandwait(num)
for i=1, num do
print("help "..i)
win.Sleep(1000)
end
end
local to = thread.newthread(printandwait,{5})
print(to:getthreadpriority(1))
print(to:setthreadpriority(thread.THREAD_PRIORITY_ ABOVE_NORMAL))
print(to:getthreadpriority(1))
The output looks like this:
help 1
nil
nil
nil
help 2
help 3
help 4
help 5
Am I using these wrong?
:getthreadpriority() doesn't appear to return anything (nil)
:getthreadpriority() appears to require an undocumented input value (number)
:setthreadpriority() doesn't appear to change the priority (checked in a debugger)
:setthreadpriority() doesn't appear to return the previous priority
Before you ask, the spawned thread is NOT exiting before the calls are made. :)
Here is code that shows most of these problems:
local function printandwait(num)
for i=1, num do
print("help "..i)
win.Sleep(1000)
end
end
local to = thread.newthread(printandwait,{5})
print(to:getthreadpriority(1))
print(to:setthreadpriority(thread.THREAD_PRIORITY_ ABOVE_NORMAL))
print(to:getthreadpriority(1))
The output looks like this:
help 1
nil
nil
nil
help 2
help 3
help 4
help 5
Am I using these wrong?