[Issue 8960] DMD tester: Unable to set thread priority

2015-02-18 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=8960

--- Comment #9 from github-bugzi...@puremagic.com ---
Commits pushed to 2.067 at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/62696b4d8aa1f919071d8d3726c06998b06dd787
fix Issue 8960 - Unable to set thread priority

https://github.com/D-Programming-Language/druntime/commit/b188057f1b9edd57cb956c5fdd86a7878a6529d9
Merge pull request #550 from MartinNowak/fix8960

--


[Issue 8960] DMD tester: Unable to set thread priority

2014-09-28 Thread via Digitalmars-d-bugs
https://issues.dlang.org/show_bug.cgi?id=8960

--- Comment #8 from github-bugzi...@puremagic.com ---
Commits pushed to master at https://github.com/D-Programming-Language/druntime

https://github.com/D-Programming-Language/druntime/commit/62696b4d8aa1f919071d8d3726c06998b06dd787
fix Issue 8960 - Unable to set thread priority

- Ignore error when get-/setting the priority of a terminated thread.

https://github.com/D-Programming-Language/druntime/commit/b188057f1b9edd57cb956c5fdd86a7878a6529d9
Merge pull request #550 from MartinNowak/fix8960

fix Issue 8960 - Unable to set thread priority

--


[Issue 8960] DMD tester: Unable to set thread priority

2013-12-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=8960



--- Comment #7 from Martin Nowak  2013-12-05 07:30:46 PST ---
Also see
https://github.com/D-Programming-Language/druntime/pull/542
https://github.com/D-Programming-Language/druntime/pull/550

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8960] DMD tester: Unable to set thread priority

2013-12-05 Thread d-bugmail
https://d.puremagic.com/issues/show_bug.cgi?id=8960


Martin Nowak  changed:

   What|Removed |Added

   Priority|P2  |P4
 CC||c...@dawg.eu


--- Comment #6 from Martin Nowak  2013-12-05 07:29:26 PST ---
Also fails on OSX.

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8960] DMD tester: Unable to set thread priority

2013-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8960


Maxim Fomin  changed:

   What|Removed |Added

 CC||bitwo...@qq.com


--- Comment #5 from Maxim Fomin  2013-06-13 00:39:50 PDT 
---
*** Issue 9595 has been marked as a duplicate of this issue. ***

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8960] DMD tester: Unable to set thread priority

2013-06-13 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8960


Maxim Fomin  changed:

   What|Removed |Added

   Keywords||pull
  Component|DMD |druntime


--- Comment #4 from Maxim Fomin  2013-06-13 00:38:54 PDT 
---
https://github.com/D-Programming-Language/druntime/pull/517

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8960] DMD tester: Unable to set thread priority

2013-06-11 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8960


Maxim Fomin  changed:

   What|Removed |Added

 CC||ma...@maxim-fomin.ru


--- Comment #3 from Maxim Fomin  2013-06-11 05:06:28 PDT 
---
Reduced (compile with -unittest)
-
import std.parallelism;
import std.stdio;
import core.thread;

unittest
{
static void refFun(ref uint num)
{
num++;
}

uint x;

// Test executeInNewThread().
auto ct = scopedTask!refFun(x);
ct.executeInNewThread(Thread.PRIORITY_MAX);
ct.yieldForce;
assert(ct.args[0] == 1);


}

void main(){}
-

According to observations it can fail in getter or in setter of thread
priority. It seems that return code from pthread setters/getters is 3 which is
ESRCH, which in pthread context means non-existing thread. Following snippet
from std.parallelism gives a clue:

this(AbstractTask* task, int priority = int.max)
{
assert(task);

// Dummy value, not used.
instanceStartIndex = 0;

this.isSingleTask = true;
task.taskStatus = TaskStatus.inProgress;
this.head = task;
singleTaskThread = new Thread(&doSingleTask);
singleTaskThread.start();

if(priority != int.max)
{
singleTaskThread.priority = priority;
}
}

Thread may finish before setting priorities as it was started before applying
them. It seems that thread ID is same in three cases 1) before getter 2) before
setter 3) in gdb message informing that thread has finished. Originally I got
approx 1-2 per 100 executions but after inserting debug outputs the failure
percentage increased (as I suppose) because thread had more chances to
terminate before applying priorities. Also, there were cases when gdb reported
that thread has finished before priority setter started execution.

Can someone who uses FreeBSD check this?

https://github.com/mxfm/phobos/commit/50854c479e4d965271fbb91f9203d24ac81b6820

https://github.com/mxfm/druntime/commit/0d60b15efdaebae65ee9109ca3a90aaee177a341

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---


[Issue 8960] DMD tester: Unable to set thread priority

2013-02-27 Thread d-bugmail
http://d.puremagic.com/issues/show_bug.cgi?id=8960


Andrej Mitrovic  changed:

   What|Removed |Added

 Status|RESOLVED|REOPENED
   See Also||http://d.puremagic.com/issu
   ||es/show_bug.cgi?id=9595
 Resolution|WORKSFORME  |
Summary|DMD 2.061 git head: Unable  |DMD tester: Unable to set
   |to set thread priority  |thread priority


--- Comment #2 from Andrej Mitrovic  2013-02-27 
15:18:55 PST ---
It still happens randomly in every other pull request, so I'll have to reopen.

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
--- You are receiving this mail because: ---