mtx_timedlock

Defined in header <threads.h> int mtx_timedlock( mtx_t *restrict mutex, const struct timespec *restrict time_point ); (since C11) Blocks the current thread until the mutex pointed to by mutex is locked or until the TIME_UTC based time point pointed to by time_point has been reached. The behavior is undefined if the current thread has already locked the mutex and the mutex is not recursive. The behavior is undefined if the mutex does not support timeout. P

return

Usage return statement: as the declaration of the statement

signal

Defined in header <signal.h> void (*signal( int sig, void (*handler) (int))) (int); Sets the error handler for signal sig. The signal handler can be set so that default handling will occur, signal is ignored, or an user-defined function is called. When signal handler is set to a function and a signal occurs, it is implementation defined whether signal(sig, SIG_DFL) will be executed immediately before the start of signal handler. Also, the implementation can prevent some imp

while loop

Executes a statement repeatedly, until the value of expression becomes equal to zero. The test takes place before each iteration. Syntax while ( expression ) statement expression - any expression of scalar type. This expression is evaluated before each iteration, and if it compares equal to zero, the loop is exited. statement - any statement, typically a compound statement, which serves as the body of the loop Explanation A while statement causes the statement (also

SIG_DFL

Defined in header <signal.h> #define SIG_DFL /*implementation defined*/ #define SIG_IGN /*implementation defined*/ The SIG_DFL and SIG_IGN macros expand into integral expressions that are not equal to an address of any function. The macros define signal handling strategies for signal() function. Constant Explanation SIG_DFL default signal handling SIG_IGN signal is ignored Example #include <signal.h> #include <stdio.h> int main(void) {

#include directive

Includes another source file into the current source file at the line immediately after the directive. Syntax #include <filename> (1) #include "filename" (2) Explanation Includes source file, identified by filename, into the current source file at the line immediately after the directive. The first version of the directive searches only standard include directories. The standard C++ library, as well as standard C library, is implicitly included in standard include dire

wcsrtombs

Defined in header <wchar.h> size_t wcsrtombs( char *dst, const wchar_t **src, size_t len, mbstate_t* ps ) (1) (since C95) errno_t wcsrtombs_s( size_t *restrict retval, char *restrict dst, rsize_t dstsz, const wchar_t **restrict src, rsize_t len, mbstate_t *restrict ps); (2) (since C11) 1) Converts a sequence of wide characters from the array whose first element is pointed to by *src to its narrow multibyte representation that begins in the conver

Algorithms

Defined in header <stdlib.h> qsortqsort_s (C11) sorts a range of elements with unspecified type (function) bsearchbsearch_s (C11) searches an array for an element of unspecified type (function) References C11 standard (ISO/IEC 9899:2011): 7.22.5 Searching and sorting utilities (p: 354-356) K.3.6.3 Searching and sorting utilities (p: 607-609) C99 standard (ISO/IEC 9899:1999): 7.20.5 Searching and sorting utilities (p: 318-319) C89/C90 standard (ISO/IEC 9899:

thrd_join

Defined in header <threads.h> int thrd_join( thrd_t thr, int *res ); (since C11) Blocks the current thread until the thread identified by thr finishes execution. If res is not a null pointer, the result code of the thread is put to the location pointed to by res. The termination of the thread synchronizes-with the completion of this function. The behavior is undefined if the thread was previously detached or joined by another thread. Parameters thr - identifier of t

timespec_get

Defined in header <time.h> int timespec_get( struct timespec *ts, int base) (since C11) #define TIME_UTC /* implementation-defined */ (since C11) 1) Modifies the timespec object pointed to by ts to hold the current calendar time in the time base base. 2) Expands to a value suitable for use as the base argument of timespec_get Other macro constants beginning with TIME_ may be provided by the implementation to indicate additional time bases. If base is TIME_UTC, then