NKern::Lock()

This document specifies that the method NKern::Lock() is now obsolete and suggests alternative locking mechanisms.

Description of NKern::Lock()

This method disables the scheduler and the IDFC (Immediate Deferred Function Call), so that the currently running thread cannot be pre-empted.

This is used to prevent a thread from being re-entered while it is processing data, and so that no data will be corrupted as a result.

The reason why NKern::Lock() is now obsolete

The NKern::Lock() method can no longer be used as a means to stop scheduling, since it only affects the core that the code is running on.

The replacement for NKern::Lock()

This method should be replaced with one of the following (depending on the circumstances ):

Areas that could be affected

At present, the replacement of this method only affects kernel services to user side code through an executive call (these are made via the Exec class). This can occur in the following areas:

  • A DLogicalChannelBase derived driver

  • A HAL (Hardware Abstraction Layer) handle implementation

  • Drivers that contain multiple threads

  • Code which is called back in the context of an unrelated thread. For example,TTickLink or BSP (Board Support Package) drivers.