home *** CD-ROM | disk | FTP | other *** search
- /*================================================*/
- /* TVMALLOC.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 malloc
-
- /*================================================*/
-
- extern OBJECT _TV_alloc_mutex_ ;
-
- /*================================================*/
- /* _TV_malloc version of malloc which is safe in */
- /* the presence of multiple threads */
- /* Ralf Brown 5/10/88 */
- /*================================================*/
-
- void *_TV_malloc(size_t size)
- {
- void *retval ;
-
- if (!TVisobj(_TV_alloc_mutex_))
- _TV_alloc_mutex_ = TVmbx_new() ;
- TVlock(_TV_alloc_mutex_) ;
- retval = malloc(size) ;
- TVunlock(_TV_alloc_mutex_) ;
- return retval ;
- }
-
- /* End of TVMALLOC.C */
-