Changeset 4243:2ab21e14c42a in roaraudio for libroar/libroar.c


Ignore:
Timestamp:
08/25/10 15:36:19 (14 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

replaced *ROAR_MLOCK() with modern roar_mm_m*lock*()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroar/libroar.c

    r3811 r4243  
    3636#include "libroar.h" 
    3737 
    38 int _ROAR_MLOCK(const void *addr, size_t len) { 
     38#ifndef roar_mm_mlock 
     39int roar_mm_mlock(const void *addr, size_t len) { 
    3940#if defined(ROAR_TARGET_WIN32) 
    4041 return GlobalLock(addr) == addr ? 0 : -1; 
     
    5253#endif 
    5354} 
     55#endif 
     56 
     57#ifndef roar_mm_munlock 
     58int roar_mm_munlock(const void *addr, size_t len) { 
     59#if defined(ROAR_TARGET_WIN32) 
     60 // TODO: find out what do do here. GlobalUnLock()? does such a function exist? 
     61// return GlobalLock(addr) == addr ? 0 : -1; 
     62 return -1; 
     63#elif defined(ROAR_TARGET_MICROCONTROLLER) 
     64 return 0; 
     65#else 
     66 long sz = sysconf(_SC_PAGESIZE); 
     67 unsigned long int pos = (unsigned long int) addr; 
     68 
     69 len += sz - (len % sz); 
     70 
     71 pos -= pos % sz; 
     72 
     73 return munlock((void*)pos, len); 
     74#endif 
     75} 
     76#endif 
     77 
     78// for compatibility with old versions: 
     79int _ROAR_MLOCK(const void *addr, size_t len) { 
     80 roar_debug_warn_obsolete("_ROAR_MLOCK", "roar_mm_mlock", NULL); 
     81 return roar_mm_mlock(addr, len); 
     82} 
    5483 
    5584//ll 
Note: See TracChangeset for help on using the changeset viewer.