NewtonWorldCriticalSectionUnlock

From Newton Wiki
Revision as of 08:02, 10 June 2019 by WikiSysop (talk | contribs) (1 revision imported)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

NewtonWorldCriticalSectionUnlock

void NewtonWorldCriticalSectionUnlock (const NewtonWorld* const newtonWorld)

Usage

this function block all other threads from executing the same subsequent code simultaneously.

Parameters

  • const NewtonWorld* const newtonWorld

Return

  • (Procedure)

Description

Exits critical section for the given world.

This ends the mutual exclusion period for the caller thread.

Since Newton became a multithreaded library it is necessary sometimes to lock resources in order to avoid concurrent access to shared resources.

Remarks

  • this function should use to present racing conditions when when a call back ins executed form a multi threaded loop.
  • In general most call back are thread safe when they do not write to object outside the scope of the call back.
  • this means for example that the application can modify values of object pointed by the arguments and or call that function
  • that are allowed to be call for such callback.
  • There are cases, however, when the application need to collect data for the client logic, example of such case are collecting
  • information to display debug information, of collecting data for feedback.
  • In these situations it is possible the the same critical code could be execute at the same time but several thread causing unpredictable side effect.
  • so it is necessary to block all of the thread from executing any pieces of critical code.
  • it is important that the critical section wrapped by functions *NewtonWorldCriticalSectionLock* and
  • *NewtonWorldCriticalSectionUnlock* be keep small if the application is using the multi threaded functionality of the engine
  • no doing so will lead to serialization of the parallel treads since only one thread can run the a critical section at a time.

See also

NewtonWorldCriticalSectionLock