equal
deleted
inserted
replaced
37 |
37 |
38 #include <stl/_threads.h> |
38 #include <stl/_threads.h> |
39 |
39 |
40 #include "lock_free_slist.h" |
40 #include "lock_free_slist.h" |
41 |
41 |
|
42 |
42 #if defined(__SYMBIAN32__WSD__) |
43 #if defined(__SYMBIAN32__WSD__) |
43 #include "libstdcppwsd.h" |
44 #include "libstdcppwsd.h" |
44 |
45 |
45 #define __oom_handler get_oom_handler() |
46 #define __oom_handler get_oom_handler() |
46 #define _S_lock get_allocator_S_lock() |
47 #define _S_lock get_allocator_S_lock() |
372 // Beginning of the linked list of allocated chunks of memory |
373 // Beginning of the linked list of allocated chunks of memory |
373 static _ChunkList _S_chunks; |
374 static _ChunkList _S_chunks; |
374 #endif /* _STLP_DO_CLEAN_NODE_ALLOC */ |
375 #endif /* _STLP_DO_CLEAN_NODE_ALLOC */ |
375 |
376 |
376 public: |
377 public: |
|
378 |
377 /* __n must be > 0 */ |
379 /* __n must be > 0 */ |
378 static void* _M_allocate(size_t& __n); |
380 static void* _M_allocate(size_t& __n); |
379 /* __p may not be 0 */ |
381 /* __p may not be 0 */ |
380 static void _M_deallocate(void *__p, size_t __n); |
382 static void _M_deallocate(void *__p, size_t __n); |
381 |
383 |
384 #endif |
386 #endif |
385 }; |
387 }; |
386 |
388 |
387 #if !defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION) |
389 #if !defined (_STLP_USE_LOCK_FREE_IMPLEMENTATION) |
388 void* __node_alloc_impl::_M_allocate(size_t& __n) { |
390 void* __node_alloc_impl::_M_allocate(size_t& __n) { |
|
391 |
389 __n = _S_round_up(__n); |
392 __n = _S_round_up(__n); |
390 _Obj * _STLP_VOLATILE * __my_free_list = _S_free_list + _S_FREELIST_INDEX(__n); |
393 _Obj * _STLP_VOLATILE * __my_free_list = _S_free_list + _S_FREELIST_INDEX(__n); |
391 _Obj *__r; |
394 _Obj *__r; |
392 |
395 |
393 // Acquire the lock here with a constructor call. |
396 // Acquire the lock here with a constructor call. |
406 // lock is released here |
409 // lock is released here |
407 return __r; |
410 return __r; |
408 } |
411 } |
409 |
412 |
410 void __node_alloc_impl::_M_deallocate(void *__p, size_t __n) { |
413 void __node_alloc_impl::_M_deallocate(void *__p, size_t __n) { |
|
414 |
411 _Obj * _STLP_VOLATILE * __my_free_list = _S_free_list + _S_FREELIST_INDEX(__n); |
415 _Obj * _STLP_VOLATILE * __my_free_list = _S_free_list + _S_FREELIST_INDEX(__n); |
412 _Obj * __pobj = __STATIC_CAST(_Obj*, __p); |
416 _Obj * __pobj = __STATIC_CAST(_Obj*, __p); |
413 |
417 |
414 // acquire lock |
418 // acquire lock |
415 _Node_Alloc_Lock __lock_instance; |
419 _Node_Alloc_Lock __lock_instance; |