Op 2010-06-24 16:25, Jonas Maebe het geskryf: > > The POSIX pthread_setschedparam() api is not really appropriate in > this case. It's mainly geared at real-time threads, which is why POSIX
I also tried to use Google to see if there is any other way of setting thread priority, and all Google returns is the pthread_setschedparam() API. Even so, maybe TThread needs to be extended to include a Policy property as well as a Priority property. eg: TThread = class ... property Policy: TSchedulePolicy read GetPolicy write SetPolicy; This should be handy for embedded systems or other real-time apps. This made we wonder how Kylix used to manage this... I'll try later tonight at home where I have Kylix available. Looking at the Kylix 3 Help, Kylix's TThread did indeed have a Policy property. I guess one could implement it in FPC too, and will be ignored by Windows, but used in any unix-type OS. BTW: Thanks to all that replied, I think I have a much better understanding now between Thread Priority and Schedulers under Linux. It was quite confusing at first, but the more articles I read on the web, the better I understood it. ----------[ Kylix 3 Help ]------------------------------- Determines the schedule policy the thread uses (Linux only). Delphi syntax: property Policy: Integer; Description Policy is only available for applications that run under Linux. Set Policy to assign a Schedule policy for this thread with respect to other threads on the system. The value of Policy must be one of the three constants listed below: Policy Type Priority -------------------------------------------------- SCHED_RR Real Time 1-99 SCHED_FIFO Real Time 1-99 SCHED_OTHER Regular 0 Note: The type of thread policy determines the Priority that can be assigned to the thread, as indicated in the third column of the table above. Note: The values SCHED_RR and SCHED_FIFO can only be set by root. ------------------------------------------ > I'm not aware of any portable Unix API to set the priority of threads Even if a API is not portable between *nix, at least we can implement it per platform, and hopefully create some abstraction layer on top of that, or translate TThreadPriority type to the individual platform implementations. FPC has many API's implemented that are not portable between platforms - so this should not be a stopping block. Regards, - Graeme - -- fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal http://opensoft.homeip.net/fpgui/ _______________________________________________ fpc-devel maillist - [email protected] http://lists.freepascal.org/mailman/listinfo/fpc-devel
