Hi Glenn!

On Tue, May 31, 2016 at 11:11 AM, Burkhardt, Glenn B        UTAS
<[email protected]> wrote:
> The way the winpthreads code is writing, the Windows handle for the thread is 
> cleared when the thread is made detached.  That means that the 
> pthread_setschedparam() call can't work.  So thread priorities for detached 
> threads can only be set once, at thread creation, before the thread is 
> detached, or as part of the pthread_create() call.
>
> Is there a reason for this?  For me, it's unexpected behavior.

I don't see anything in the pthreads documentation that makes clear
whether this should be allowed or not.  However, the error-code return
values for pthread_setschedparam() does not list an error value for
this situation, which perhaps is a hint that it should work.

On the other hand, there does seem to be precedent for this not working.

I found some documentation for DEC / VMS pthreads here:

   http://www.mi.infn.it/~calcolo/OpenVMS/ssb71/6493/6493p002.htm

Quoting from paragraph 2.3.4:

   It is illegal for your program to attempt any operation on a detached
   thread or to use any information in the thread object associated with
   a detached thread. For instance, a thread cannot join on a detached
   thread, and your program cannot cancel a detached thread.

So it sounds like the VMS implementation, at least, doesn't support calling
pthread_setschedparam() on a detached thread.

(I wonder if a detached thread calling pthread_setschedparam() on itself
could be an edge case in some implementations.)


Happy Hacking!


K. Frank

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity 
planning reports. https://ad.doubleclick.net/ddm/clk/305295220;132659582;e
_______________________________________________
Mingw-w64-public mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mingw-w64-public

Reply via email to