ctThrdBlockInit Initialize memory for a thread block. Short Name ctThrdBlockInit() Type Threading Function Declaration NINT ctThrdBlockInit(pctBLOCK block) Description ctThrdBlockInit() provides a means to initialize block. Before using a block the memory for the block must be cleared. If this space is initialized when allocated, this function is not needed. However, if the block memory requires “zeroing out”, this function provides a convenient way to perform this task. This is most common when a block is defined on the stack within an application. In essence, this function simply initializes (memset()) the memory. Return ctThrdBlockInit() always returns NO_ERROR. See “c-tree Plus Error Codes” in the c-tree Plus Programmer’s Reference Guide for a complete listing of valid c-tree Plus error values. Example NINT err; /* ctThrdInit return code. */ ctBLOCK guiblk; /* Block to wait for window creation. */ ctMUTEX tfin_mtx; /* Mutex for thread finished counter. */
ctMUTEX tprt_mtx; /* Mutex for displaying thread output.*/ #endif /* USE_CURSES || USE_ANSI */
ctrt_printf("\nctThrdInit failed. Error={%d}\n", err);
ctrt_exit(1); }
ctThrdBlockInit(&guiblk); ctThrdMutexInit(&tfin_mtx);
ctThrdMutexInit(&tprt_mtx); #endif /* USE_CURSES || USE_ANSI */ See also ctThrdMutexInit() |
|||