Commit Graph

118 Commits

Author SHA1 Message Date
Masayuki Ishikawa 09d4874509 Merged in masayuki2009/nuttx.nuttx/lc823450 (pull request #524)
Fix DEBUGASSERT() issues with nxhello on lc823450-xgevk

* sched/task: Remove DEBUGASSERT in task_exitstatus() and task_groupexit()

* graphics: Change DEBUGASSERT condition in nx_runinstance()

Approved-by: Gregory Nutt <gnutt@nuttx.org>
2017-10-31 16:53:00 +00:00
Gregory Nutt 5b385f4d4d kthread_create(): Rename kernel_thread() to kthread_create() for better naming consistency with task_create() and kthread_delete(). 2017-10-16 11:38:00 -06:00
Gregory Nutt b1a41b7620 task_delete(): Do not permit user applications to delete kernel threads. 2017-10-16 09:07:27 -06:00
Gregory Nutt fd58bfd9c0 sched/signal: Add logic to wake up a thread that is waiting on a signal if it is canceled. 2017-10-12 08:55:19 -06:00
Gregory Nutt 3cd41b0408 sched/task: task_exithook.c fails to link if signals are disabled because was unconditionally trying to send the SIGCHLD signal to the parent in certain configurations. Noted by Jeongchan Kim. 2017-10-11 10:43:30 -06:00
Gregory Nutt 9b61cc6b25 task: Add new cancellation point interface, check_cancellation_point(). 2017-10-09 09:43:04 -06:00
Gregory Nutt e7c52bac60 Squashed commit of the following:
sched/mqueue:  Rename all private static functions for use the nxmq_ vs. mq_ naming.

    sched/mqueue:  Rename all OS internal functions declared in sched/mqueue/mqueue.h to begin with nxmq_ vs. mq_.  The mq_ prefix is reserved for standard application interfaces.
2017-10-09 09:06:46 -06:00
Gregory Nutt d633c9bf8c Squashed commit of the following:
Replace all calls to sigprocmask() in the OS proper with calls to nxsig_procmask().

    sched/signal:  Add internal OS interface nxsig_procmask().  This internal interface is equivalent to the standard sigprocmask() used by applications except that it does not modify the errno value.  Also fixes a problem in that the original sigprocmask() was not setting the errno.
2017-10-07 12:16:10 -06:00
Gregory Nutt 8198ba6a6d This change renames all internal, private NuttX signal-related functions to use the prefix nxsig_ so that they cannot be confused with application interfaces that begin, primarily, with sig_
This is analogous to similar renaming that was done previously for semaphores.

Squashed commit of the following:

    sched/signal:  Fix a few compile warnings introduced by naming changes.

    sched/signal:  Rename all private, internal signl functions to use the nxsig_ prefix.

    sched/signal:  Rename sig_removependingsignal, sig_unmaskpendingsignal, and sig_mqnotempty to nxsig_remove_pendingsignal, nxsig_unmask_pendingsignal, and nxsig_mqnotempty to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_findaction and sig_lowest to nxsig_find_action and nxsig_lowest to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_allocatepingsigaction and sig_deliver to nxsig_alloc_pendingsigaction and nxsig_deliver to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_cleanup, sig_release, sig_releasependingaction, and sig_releasependingsignal to nxsig_cleanup, nxsig_release, nxsig_release_pendingaction, and nxsig_release_pendingsignal to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_tcbdispatch and sig_dispatch to nxsig_tcbdispatch and nxsig_dispatch to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_releaseaction and sig_pendingset to nxsig_release_action and nxsig_pendingset to make it clear that these are OS internal interfaces.

    sched/signal:  Rename sig_initialize and sig_allocateactionblock to nxsig_initialize and nxsig_alloc_actionblock to make it clear that these are OS internal interfaces.
2017-10-05 13:25:25 -06:00
Gregory Nutt 9568600ab1 Squashed commit of the following:
This commit backs out most of commit b4747286b1.  That change was added because sem_wait() would sometimes cause cancellation points inappropriated.  But with these recent changes, nxsem_wait() is used instead and it is not a cancellation point.

    In the OS, all calls to sem_wait() changed to nxsem_wait().  nxsem_wait() does not return errors via errno so each place where nxsem_wait() is now called must not examine the errno variable.

    In all OS functions (not libraries), change sem_wait() to nxsem_wait().  This will prevent the OS from creating bogus cancellation points and from modifying the per-task errno variable.

    sched/semaphore:  Add the function nxsem_wait().  This is a new internal OS interface.  It is functionally equivalent to sem_wait() except that (1) it is not a cancellation point, and (2) it does not set the per-thread errno value on return.
2017-10-04 15:22:27 -06:00
Gregory Nutt 42a0796615 Squashed commit of the following:
sched/semaphore:  Add nxsem_post() which is identical to sem_post() except that it never modifies the errno variable.  Changed all references to sem_post in the OS to nxsem_post().

    sched/semaphore:  Add nxsem_destroy() which is identical to sem_destroy() except that it never modifies the errno variable.  Changed all references to sem_destroy() in the OS to nxsem_destroy().

    libc/semaphore and sched/semaphore:  Add nxsem_getprotocol() and nxsem_setprotocola which are identical to sem_getprotocol() and set_setprotocol() except that they never modifies the errno variable.  Changed all references to sem_setprotocol in the OS to nxsem_setprotocol().  sem_getprotocol() was not used in the OS
2017-10-03 15:35:24 -06:00
Gregory Nutt 83cdb0c552 Squashed commit of the following:
libc/semaphore:  Add nxsem_getvalue() which is identical to sem_getvalue() except that it never modifies the errno variable.  Changed all references to sem_getvalue in the OS to nxsem_getvalue().

    sched/semaphore:  Rename all internal private functions from sem_xyz to nxsem_xyz.  The sem_ prefix is (will be) reserved only for the application semaphore interfaces.

    libc/semaphore:  Add nxsem_init() which is identical to sem_init() except that it never modifies the errno variable.  Changed all references to sem_init in the OS to nxsem_init().

    sched/semaphore:  Rename sem_tickwait() to nxsem_tickwait() so that it is clear this is an internal OS function.

    sched/semaphoate:  Rename sem_reset() to nxsem_reset() so that it is clear this is an internal OS function.
2017-10-03 12:52:31 -06:00
Gregory Nutt 374f1bd46c binfmt: Don't schedule starthook if there are no constructors. 2017-10-02 14:04:50 -06:00
Arjun Hary b274a97840 Miscellaneous fixes from astyle tool. 2017-08-14 17:19:27 -06:00
Gregory Nutt 2245dddaf9 Break up some long lines 2017-06-14 13:42:56 -06:00
Gregory Nutt 0de294a586 Fix lots of occurrences of 'the the', 'the there', 'the these', 'the then', 'the they. 2017-05-11 13:35:56 -06:00
Nobutaka Toyoshima 150036eb8b sched: Fix tg_flags check with GROUP_FLAG_NOCLDWAIT
Jira: PDFW15IS-208
Signed-off-by: Masayuki Ishikawa <Masayuki.Ishikawa@jp.sony.com>
2017-04-14 14:50:44 +09:00
Gregory Nutt b55a98e900 Olimex-STM32-P407: Enable task names 2017-03-04 08:49:24 -06:00
Gregory Nutt dca77fa06a sigtimedwait: When timer expires, up_unblock_task() is called. This is okay in the single CPU case because interrupts are disable in the timer interrupt handler. But it is insufficient in the SMP case. enter_ and leave_critical_section() must be called in order to manage spinlocks correctly. 2017-02-24 10:07:23 -06:00
Gregory Nutt d5b1ca14e2 Update README and some comments. 2017-01-02 13:54:07 -06:00
Gregory Nutt d648f9c8b4 Add task_testcancel() 2016-12-10 16:34:14 -06:00
Gregory Nutt f132960789 Add task_setcanceltype() 2016-12-10 16:06:14 -06:00
Gregory Nutt 5fb207eb36 Add task_setcancelstate() 2016-12-10 15:16:46 -06:00
Gregory Nutt 698597a838 task_delete() now obeys all cancellation point semantics. 2016-12-10 14:39:19 -06:00
Gregory Nutt b52e4e5ecd Move cancellation point definitions to their own header file. 2016-12-10 09:08:26 -06:00
Gregory Nutt bc3ca25cc7 Cancellation points: Close up some logic to eliminte some race conditions. 2016-12-10 08:36:58 -06:00
Gregory Nutt 3eba0acb1c More cancellation points. 2016-12-09 13:49:36 -06:00
Gregory Nutt c9ca97b4b5 cancellation points are basically function. More tested is needed and additional cancellation points must be implemented before this can be merged back to master. 2016-12-09 12:01:18 -06:00
Gregory Nutt d35e589d56 Flesh basic cancellation point support 2016-12-09 09:44:23 -06:00
Gregory Nutt 82a79b9c1b Add framework for cancellation point support. 2016-12-09 08:13:28 -06:00
Gregory Nutt acaae12e8b Add pthread_testcancel(), pthread_testcancel(), and definitiions for cancellation types. 2016-12-09 07:23:00 -06:00
Gregory Nutt ab43681f15 Update TODO and some comments. 2016-12-08 10:24:40 -06:00
Gregory Nutt a1fbc2ad0d pthreads: Add pthread_cleanup_push() and pthread_cleanup_pop() 2016-12-08 09:27:13 -06:00
Gregory Nutt 7632dfd6c7 Update some comments. 2016-12-08 07:52:02 -06:00
Gregory Nutt bac7153609 SMP: Add logic to avoid a deadlock condition when CPU1 is hung waiting for g_cpu_irqlock and CPU0 is waitin for g_cpu_paused 2016-11-22 11:34:16 -06:00
Gregory Nutt 2d1765a014 Remove more of those annoying empty comment blocks. 2016-11-21 07:34:27 -06:00
Gregory Nutt 0029c04dad task_restart: Make sure new task starts with pre-emption disabled and not in a critical section. 2016-11-21 07:33:23 -06:00
Gregory Nutt e24f281401 This commit adds a new internal interfaces and fixes a problem with three APIs in the SMP configuration. The new internal interface is sched_cpu_pause(tcb). This function will pause a CPU if the task associated with 'tcb' is running on that CPU. This allows a different CPU to modify that OS data stuctures associated with the CPU. When the other CPU is resumed, those modifications can safely take place.
The three fixes are to handle cases in the SMP configuration where one CPU does need to make modifications to TCB and data structures on a task that could be running running on another CPU.  Those three cases are task_delete(), task_restart(), and execution of signal handles.  In all three cases the solutions is basically the same:  (1) Call sched_cpu_pause(tcb) to pause the CPU on which the task is running, (2) perform the necessary operations, then (3) call up_cpu_resume() to restart the paused CPU.
2016-11-20 07:57:18 -06:00
Gregory Nutt f40fbaa4b9 sched/task: task_restart() test not supported on SMP systems. This is not fully implemented. 2016-11-19 11:41:05 -06:00
Gregory Nutt 5ca9128c38 Update comments 2016-11-19 08:33:55 -06:00
Gregory Nutt ceacacbc63 vfork(): Fix a race condition in the SMP case. Existing logic depended on the fact that the child would not run until waitpid was called because the child had the same priority as the parent. BUT in the SMP case that is not true... the child may run immediately on a different CPU. 2016-11-19 07:30:01 -06:00
Gregory Nutt 8669183852 sched/pthread and task: When a pthread is started, there is a small bit of logic that will run on the thread of execution of the new pthread. In the case where the new pthread has a lower priority than the parent thread, then this could cause both the parent thread and the new pthread to be blocked at the priority of the lower priority pthread (assuming that CONFIG_PRIORITY_INHERITANCE is not selected).
This change temporarily boosts the priority of the new pthread to at least the priority of the new pthread to at least the priority of the parent thread.  When that bit of logic has executed on the thread of execution of the new pthread, it will then drop to the correct priority (if necessary) before calling into the new pthread's entry point.
2016-10-01 11:38:22 -06:00
Gregory Nutt 75104b0808 Remove duplicate function prototype from wrong header file 2016-10-01 10:56:42 -06:00
Gregory Nutt 952268274a sched/: Fix misplaced right bracket; remove redundant assertion. 2016-09-06 12:27:12 -06:00
Gregory Nutt 7582c2344c sched/: Eliminate calculation of a possibly unused value. 2016-09-06 10:28:19 -06:00
Gregory Nutt e034c78516 improve some assertions; add some comments. 2016-09-06 10:21:41 -06:00
Gregory Nutt 27919549f1 sched/: Simplify some child/parent logic 2016-09-06 08:40:55 -06:00
Gregory Nutt 05aa586aa6 sched/: Move fields related to parent/child task relationship out of TCB into group structure. 2016-09-06 08:28:31 -06:00
Gregory Nutt 858af4295c The TCB nchildren field should not be incremented when pthreads are created. 2016-09-06 07:34:36 -06:00
Gregory Nutt 13cac3b592 sched/: Change some *err() message to *info() messages if what was a *dbg() message does not indicate and error condition. 2016-06-11 16:42:42 -06:00