bump thread priority in encoded payload generation to fix thread starvation issues
git-svn-id: file:///home/svn/framework3/trunk@3777 4d416f70-5f16-0410-b530-b9f4589650daunstable
parent
f8ff8c6d7b
commit
144249b34d
|
@ -46,6 +46,16 @@ class EncodedPayload
|
|||
self.encoder = nil
|
||||
self.nop = nil
|
||||
|
||||
# Increase thread priority as necessary. This is done
|
||||
# to ensure that the encoding and sled generation get
|
||||
# enough time slices from the ruby thread scheduler.
|
||||
priority = Thread.current.priority
|
||||
|
||||
if (priority == 0)
|
||||
Thread.current.priority = 1
|
||||
end
|
||||
|
||||
begin
|
||||
# First, validate
|
||||
pinst.validate()
|
||||
|
||||
|
@ -60,6 +70,10 @@ class EncodedPayload
|
|||
|
||||
# Finally, set the complete payload definition
|
||||
self.encoded = (self.nop_sled || '') + self.encoded
|
||||
ensure
|
||||
# Restore the thread priority
|
||||
Thread.current.priority = priority
|
||||
end
|
||||
|
||||
# Return the complete payload
|
||||
return encoded
|
||||
|
|
Loading…
Reference in New Issue