c-pal/linux/devdoc/platform_linux_requirements.md

1.8 KiB

platform_linux

Overview

platform_linux provides initializes the completion_port object.

Exposed API

MOCKABLE_FUNCTION(, int, platform_init);
MOCKABLE_FUNCTION(, void, platform_deinit);
MOCKABLE_FUNCTION(, COMPLETION_PORT_HANDLE, platform_get_completion_port);

platform_init

MOCKABLE_FUNCTION(, int, platform_init);

platform_init initializes the completion port object if it's not initialized

SRS_PLATFORM_LINUX_11_001: [ If the completion port object is NULL, platform_init shall call completion_port_create. ]

SRS_PLATFORM_LINUX_11_002: [ If completion_port_create returns a valid completion port object, platform_init shall return zero. ]

SRS_PLATFORM_LINUX_11_007: [ If the completion port object is non-NULL, platform_init shall return zero. ]

SRS_PLATFORM_LINUX_11_003: [ otherwise, platform_init shall return a non-zero value. ]

platform_deinit

MOCKABLE_FUNCTION(, void, platform_deinit);

platform_deinit .

SRS_PLATFORM_LINUX_11_004: [ If the completion port object is non-NULL, platform_deinit shall decrement whose reference by calling completion_port_dec_ref. ]

SRS_PLATFORM_LINUX_11_008: [ If the completion port object is non-NULL, platform_deinit shall do nothing. ]

platform_get_completion_port

MOCKABLE_FUNCTION(, COMPLETION_PORT_HANDLE, platform_get_completion_port);

platform_get_completion_port returns the completion port object reference.

SRS_PLATFORM_LINUX_11_005: [ If the completion object is not NULL, platform_get_completion_port shall increment the reference count of the COMPLETION_PORT_HANDLE object by calling completion_port_inc_ref. ]

SRS_PLATFORM_LINUX_11_006: [ platform_get_completion_port shall return the completion object. ]