diff options
author | 2016-03-12 12:31:13 +0100 | |
---|---|---|
committer | 2016-03-12 12:31:13 +0100 | |
commit | a026a582f1a0ea8c1ede3acaddacef506ef3f3b0 (patch) | |
tree | e31573822f2359677de519f9f3b600d98e8764cd /3rdparty/luv/tests/test-work.lua | |
parent | 477d2abd43984f076b7e45f5527591fa8fd0d241 (diff) | |
parent | dcab55bf53b94713a6f72e9633f5101c8dd6c08c (diff) |
Merge pull request #15 from mamedev/master
Sync to base master
Diffstat (limited to '3rdparty/luv/tests/test-work.lua')
-rw-r--r-- | 3rdparty/luv/tests/test-work.lua | 48 |
1 files changed, 0 insertions, 48 deletions
diff --git a/3rdparty/luv/tests/test-work.lua b/3rdparty/luv/tests/test-work.lua deleted file mode 100644 index 3a98b15e6bc..00000000000 --- a/3rdparty/luv/tests/test-work.lua +++ /dev/null @@ -1,48 +0,0 @@ -return require('lib/tap')(function (test) - test("test threadpool", function(print,p,expect,_uv) - p('Please be patient, the test cost a lots of time') - local count = 1000 --for memleaks dected - local step = 0 - local ctx - ctx = _uv.new_work( - function(n,s) --work,in threadpool - local uv = require('luv') - local t = uv.thread_self() - uv.sleep(100) - return n,n*n, tostring(uv.thread_self()),s - end, - function(n,r,id, s) - assert(n*n==r) - if step < count then - _uv.queue_work(ctx,n,s) - step = step + 1 - if (step % 100==0) then - p(string.format('run %d%%', math.floor(step*100/count))) - end - end - end --after work, in loop thread - ) - local ls = string.rep('-',4096) - - _uv.queue_work(ctx,2,ls) - _uv.queue_work(ctx,4,ls) - _uv.queue_work(ctx,6,ls) - _uv.queue_work(ctx,-2,ls) - _uv.queue_work(ctx,-11,ls) - _uv.queue_work(ctx,2,ls) - _uv.queue_work(ctx,4,ls) - _uv.queue_work(ctx,6,ls) - _uv.queue_work(ctx,-2,ls) - _uv.queue_work(ctx,-11,ls) - _uv.queue_work(ctx,2,ls) - _uv.queue_work(ctx,4,ls) - _uv.queue_work(ctx,6,ls) - _uv.queue_work(ctx,-2,ls) - _uv.queue_work(ctx,-11,ls) - _uv.queue_work(ctx,2,ls) - _uv.queue_work(ctx,4,ls) - _uv.queue_work(ctx,6,ls) - _uv.queue_work(ctx,-2,ls) - _uv.queue_work(ctx,-11,ls) - end) -end) |