r6.1.1:abstraction_thread_wait

From liblfds.org
Jump to navigation Jump to search

Source Files

/test/src/abstraction_thread_wait.c
/test/src/abstraction.h

Prototype

void abstraction_thread_wait( thread_state_t thread_state );

Parameters

thread_state_t *thread_state

The address of a thread_state_t which has been initialised by abstration_thread_start.

Return Value

No return value.

Notes

This function provides the test program with a way to wait until a thread terminates.

Examples

Under Windows (32-bit and 64-bit), using the Microsoft C compiler, the function WaitForSingleObject is used to create threads and this function has following prototype;

DWORD WINAPI WaitForSingleObject( __in HANDLE hHandle, __in DWORD dwMilliseconds );

As such, the implementation of lfds611_abstraction_thread_wait() on all Windows, for all CPUs, using the Microsoft C compiler, looks like this;

#if (defined _WIN32 && defined _MSC_VER)

  /* TRD : any Windows on any CPU with the Microsoft C compiler

           _WIN32    indicates 64-bit or 32-bit Windows
           _MSC_VER  indicates Microsoft C compiler
  */

  void abstraction_thread_wait( thread_state_t thread_state )
  {
    WaitForSingleObject( thread_state, INFINITE );

    return;
  }

#endif

See Also