summaryrefslogtreecommitdiff
path: root/source/tests/05-physfs/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/tests/05-physfs/main.cpp')
-rw-r--r--source/tests/05-physfs/main.cpp32
1 files changed, 20 insertions, 12 deletions
diff --git a/source/tests/05-physfs/main.cpp b/source/tests/05-physfs/main.cpp
index b547f1f..4400c44 100644
--- a/source/tests/05-physfs/main.cpp
+++ b/source/tests/05-physfs/main.cpp
@@ -25,35 +25,43 @@ function main()
print(file:GetFileName())
print(file:GetExtension())
print(file:GetName())
-
dst = DataBuffer.New(138567)
- thread = Thread.New("IO thread")
+ thread = Thread.New(EThreadType.DEFFERRED)
local content = ""
local cont = "ok"
+ if true then
+ local buff=DataBuffer.New(10)
+ print(buff:GetSize())
+ buff = nil
+ end
local task = IOTask.New("root/physfs2.txt", dst, EIOTaskType.READ, function(db)
function _r()
print("test..............")
local c = db:GetData()
- print(c)
+ print(#c)
end
function err(msg)
print(msg)
end
xpcall(_r, err)
+ thread:Stop()
end)
thread:AddTask(task)
- thread:Start()
-
- print("-------------end-------------")
-
- print(thread:GetName())
+ task = nil
+ thread:Start()
- while(true) do
+ while true do
thread:Post()
- Thread.Sleep(100)
+ Thread.Sleep(100)
+ local a = io.read()
+ if a == "x" then
+ thread:Stop()
+ end
+ if thread:IsStopped() then
+ break
+ end
end
- io.read()
end
function err(msg)
@@ -70,7 +78,7 @@ int main(int argc, char* args[])
// ÿһasura򱣴һlua stateһһlua߳
AEScripting::LuaEnv::Get()->Init();
- Luax::LuaxState& state = LuaEnv::Get()->GetMainLuaxState();
+ LUAX_STATE(LuaEnv::Get()->GetMainThread());
state.OpenLibs();
state.PushGlobalNamespace();