home *** CD-ROM | disk | FTP | other *** search
- /*================================================*/
- /* TVCALLOC.C */
- /* */
- /* (c) Copyright 1988 Ralf Brown */
- /* All Rights Reserved */
- /* May be freely copied for noncommercial use as */
- /* long as this copyright notice is kept intact */
- /* and any changes are indicated in the comment */
- /* blocks for the functions */
- /*================================================*/
-
- #include "tvapi.h"
-
- #undef calloc
-
- /*================================================*/
-
- extern OBJECT _TV_alloc_mutex_ ;
-
- /*================================================*/
- /* _TV_calloc version of calloc which is safe in */
- /* the presence of multiple threads */
- /* Ralf Brown 5/10/88 */
- /*================================================*/
-
- void *_TV_calloc(size_t nitems, size_t size)
- {
- void *retval ;
-
- if (!TVisobj(_TV_alloc_mutex_))
- _TV_alloc_mutex_ = TVmbx_new() ;
- TVlock(_TV_alloc_mutex_) ;
- retval = calloc(nitems, size) ;
- TVunlock(_TV_alloc_mutex_) ;
- return retval ;
- }
-
- /* End of TVCALLOC.C */
-