Change the way thread priority is handled in binfmt/ to better match the way that priority is set up for the builtin tasks

git-svn-id: http://svn.code.sf.net/p/nuttx/code/trunk@5527 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2013-01-17 00:30:12 +00:00
parent e7e1c6aee0
commit caeef71797
13 changed files with 189 additions and 49 deletions
+43
View File
@@ -66,6 +66,39 @@
* Private Functions
****************************************************************************/
/****************************************************************************
* Name: load_default_priority
*
* Description:
* Set the default priority of the module to be loaded. This may be
* changed (1) by the actions of the binary format's load() method if
* the binary format contains priority informaition, or (2) by the user
* between calls to load_module() and exec_module().
*
* Returned Value:
* Zero (OK) is returned on success; Otherwise, -1 (ERROR) is returned and
* the errno variable is set appropriately.
*
****************************************************************************/
static int load_default_priority(FAR struct binary_s *bin)
{
struct sched_param param;
/* Get the priority of this thread */
ret = sched_getparam(0, &param);
if (ret < 0)
{
bdbg("ERROR: sched_getparam failed: %d\n", errno);
return ERROR;
}
/* Save that as the priority of child thread */
bin->priority = param.sched_priority;
}
/****************************************************************************
* Name: load_absmodule
*
@@ -145,6 +178,16 @@ int load_module(FAR struct binary_s *bin)
if (bin && bin->filename)
#endif
{
/* Set the default priority of the new program. */
ret = load_default_priority(bin)
if (ret < 0)
{
/* The errno is already set in this case */
return ERROR;
}
/* Were we given a relative path? Or an absolute path to the file to
* be loaded? Absolute paths start with '/'.
*/