NVIDIA DriveOS Linux SDK API Reference

7.2.5.0 Early Access Release

Detailed Description

Typedefs

typedef void(* NvOsThreadFunction) (void *args)
 
typedef struct NvOsThreadRec * NvOsThreadHandle
 

Functions

void NvOsThreadYield (void)
 This function yields the caller thread and let other thread run. More...
 
NvU64 NvOsGetCurrentThreadId (void)
 This function returns the thread id. More...
 
NvError NvOsTlsAddTerminator (void(*func)(void *args), void *context)
 This function registers a function which will be called when thread terminates successfully. More...
 
NvOsTlsKeyHandle NvOsTlsAlloc (void)
 This function creates a thread specific data. More...
 
NvOsTlsKeyHandle NvOsTlsAllocWithDestructor (void(*destructor)(void *args))
 This function creates a thread specific data, and store function pointer into it, and the function pointer is called when thread is terminated successfully. More...
 
void NvOsTlsFree (NvOsTlsKeyHandle TlsIndex)
 This function free the thread specific data, which is pointed by TlsIndex parameter. More...
 
void * NvOsTlsGet (NvOsTlsKeyHandle TlsIndex)
 This function gets the thread specific data, which is pointed by TlsIndex parameter. More...
 
NvBool NvOsTlsRemoveTerminator (void(*func)(void *args), void *context)
 This function unregisters a function from the list of functions will be called when thread terminates successfully. More...
 
void NvOsTlsSet (NvOsTlsKeyHandle TlsIndex, void *value)
 This function set a thread specific data, which is pointed by TlsIndex parameter. More...
 
NvError NvOsThreadCreate (NvOsThreadFunction function, void *args, NvOsThreadHandle *thread)
 This function creates a thread with entry point and parameter of entry point. All signals are blocked before the thread is created, and all signals are unlocked after the thread is created. More...
 
NvError NvOsThreadJoinEx (NvOsThreadHandle t)
 This function blocks until while the thread is running, after the thread is terminated, this function unblocks. More...
 
NvError NvOsThreadSetName (NvOsThreadHandle t, const char *name)
 This function set thread name. More...
 

Typedef Documentation

◆ NvOsThreadFunction

typedef void(* NvOsThreadFunction) (void *args)

Thread entry point

Definition at line 1711 of file nvos_s3_tegra_safety.h.

◆ NvOsThreadHandle

typedef struct NvOsThreadRec* NvOsThreadHandle

Handle for NvOS thread. This is an opaque type and should not be dereferenced.

Definition at line 1716 of file nvos_s3_tegra_safety.h.

Function Documentation

◆ NvOsGetCurrentThreadId()

NvU64 NvOsGetCurrentThreadId ( void  )

This function returns the thread id.

Returns
Followed the return value of pthread_self() in QNX libc
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsThreadCreate()

NvError NvOsThreadCreate ( NvOsThreadFunction  function,
void *  args,
NvOsThreadHandle *  thread 
)

This function creates a thread with entry point and parameter of entry point. All signals are blocked before the thread is created, and all signals are unlocked after the thread is created.

Parameters
[in]functionThe entry point of thread
[in]argsGive as a parameter of function parameter
[out]threadNvOS thread handle
Returns
NvSuccess Success
NvError_BadParameter Error if either function or thread parameter is NULL
NvError_InsufficientMemory Error if failed to allocate memory for creating thread
NvError_InsufficientMemory Error if error is returned from pthread_create()
Precondition
None
Note
This function does not include a check for API mode as a simple wrapper of the underlying QNX_System libc_api. It is the responsibility of the caller to ensure that this API is invoked in the appropriate VM state, as described in the "API group" section below.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: No
  • Maturity: GA

◆ NvOsThreadJoinEx()

NvError NvOsThreadJoinEx ( NvOsThreadHandle  t)

This function blocks until while the thread is running, after the thread is terminated, this function unblocks.

Parameters
[in]tNvOS thread handle
Returns
NvSuccess Success
NvError_BadParameter Error when NvOS thread hanle, t, is NULL or the specified thread is not joinable because it is detached from a process.
NvError_Busy Error when the specified thread is already being joined by another thread.
NvError_InvalidState Error when the calling thread is attempting to join itself.
NvError_ProcessDoesNotExist The specified thread does not exist.
NvError_Timeout Error when QNX kernel timeout unblocks the call to this API.
Precondition
NvOsThreadCreate() must be called to create the thread handle before calling this function.
Note
This function does not include a check for API mode as a simple wrapper of the underlying QNX_System libc_api. It is the responsibility of the caller to ensure that this API is invoked in the appropriate VM state, as described in the "API group" section below.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsThreadSetName()

NvError NvOsThreadSetName ( NvOsThreadHandle  t,
const char *  name 
)

This function set thread name.

Parameters
[in]tNvOS thread handle
[in]nameString pointer to set as thread name. Maimum length is _NTO_THREAD_NAME_MAX. When name is NULL,this API deletes any name already assigend to the thread.
Returns
NvSuccess Success
NvError_BadParameter t is NULL or is not NvOS thread handle returned from NvOsThreadCreate()
NvError_InvalidSize The length of name is exeeds _NTO_THREAD_NAME_MAX
NvError_Busy Another program already has write access to set a name of the given thread.
NvError_AccessDenied Does not have appropirate permission to set name
Precondition
NvOsThreadCreate() must be called to create the thread handle before calling this function.
Note
This function does not include a check for API mode as a simple wrapper of the underlying QNX_System libc_api. It is the responsibility of the caller to ensure that this API is invoked in the appropriate VM state, as described in the "API group" section below.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: No
  • Maturity: GA

◆ NvOsThreadYield()

void NvOsThreadYield ( void  )

This function yields the caller thread and let other thread run.

Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsTlsAddTerminator()

NvError NvOsTlsAddTerminator ( void(*)(void *args)  func,
void *  context 
)

This function registers a function which will be called when thread terminates successfully.

Parameters
[in]funcFunction pointer
[in]contextParameter when func parameter is called
Returns
NvSuccess Success
NvError_InsufficientMemory Error if failed to create thread-loccal-storage key to store func parameter
NvError_InsufficientMemory Error if failed to allocate memory to store func/context parameters
NvError_BadParameter Error if func parameter is NULL
Precondition
None
Note
This function does not include a check for API mode as a simple wrapper of the underlying QNX_System libc_api. It is the responsibility of the caller to ensure that this API is invoked in the appropriate VM state, as described in the "API group" section below.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: No
  • Maturity: GA

◆ NvOsTlsAlloc()

NvOsTlsKeyHandle NvOsTlsAlloc ( void  )

This function creates a thread specific data.

Returns
Not NVOS_INVALID_TLS_INDEX Success, created thread specific data can be accessible by returned NvOsTlsKeyHandle
NVOS_INVALID_TLS_INDEX Error if an error return from pthread_key_create() in QNX libc
Precondition
None
Note
This function does not include a check for API mode as a simple wrapper of the underlying QNX_System libc_api. It is the responsibility of the caller to ensure that this API is invoked in the appropriate VM state, as described in the "API group" section below.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: No
  • Maturity: GA

◆ NvOsTlsAllocWithDestructor()

NvOsTlsKeyHandle NvOsTlsAllocWithDestructor ( void(*)(void *args)  destructor)

This function creates a thread specific data, and store function pointer into it, and the function pointer is called when thread is terminated successfully.

Parameters
[in]destructorFunction pointer to store into thread specific data
Returns
Not NVOS_INVALID_TLS_INDEX Success Handle of thread specific data
NVOS_INVALID_TLS_INDEX Error if an error return from pthread_key_create() in QNX libc
Precondition
None
Note
This function does not include a check for API mode as a simple wrapper of the underlying QNX_System libc_api. It is the responsibility of the caller to ensure that this API is invoked in the appropriate VM state, as described in the "API group" section below.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: No
  • Maturity: GA

◆ NvOsTlsFree()

void NvOsTlsFree ( NvOsTlsKeyHandle  TlsIndex)

This function free the thread specific data, which is pointed by TlsIndex parameter.

Parameters
[in]TlsIndexHandle of thread specific data
Returns
N/A
Precondition
None
Note
This function does not include a check for API mode as a simple wrapper of the underlying QNX_System libc_api. It is the responsibility of the caller to ensure that this API is invoked in the appropriate VM state, as described in the "API group" section below.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsTlsGet()

void* NvOsTlsGet ( NvOsTlsKeyHandle  TlsIndex)

This function gets the thread specific data, which is pointed by TlsIndex parameter.

Parameters
[in]TlsIndexHandle of the thread specific data
Returns
Followed the return value of pthread_getspecific() in QNX libc
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: Yes
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsTlsRemoveTerminator()

NvBool NvOsTlsRemoveTerminator ( void(*)(void *args)  func,
void *  context 
)

This function unregisters a function from the list of functions will be called when thread terminates successfully.

Parameters
[in]funcFunction pointer to unregister
[in]contextParameter when func parameter is called
Returns
NV_TRUE Success
NV_FALSE Error if func (or context) parameter is not found
Precondition
NvOsTlsAddTerminator() must be called to add the function to the list
Note
This function does not include a check for API mode as a simple wrapper of the underlying QNX_System libc_api. It is the responsibility of the caller to ensure that this API is invoked in the appropriate VM state, as described in the "API group" section below.


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: No
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: No
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA

◆ NvOsTlsSet()

void NvOsTlsSet ( NvOsTlsKeyHandle  TlsIndex,
void *  value 
)

This function set a thread specific data, which is pointed by TlsIndex parameter.

Parameters
[in]TlsIndexHandle of thread specific data
[in]valuePointer to store
Returns
N/A
Precondition
None


Usage considerations

  • Allowed context for the API call
    • Interrupt handler: No
    • Signal handler: No
    • Thread-safe: Yes
    • Re-entrant: No
    • Async/Sync: Sync
  • Required privileges: None
  • Allowed execution state
    • Initialization: Yes
    • Operational: Yes
    • Reinit/Deinit Preparation: Yes
  • Maturity: GA