allocator.h 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /*
  2. * Copyright 2011 Institute of Communication and Computer Systems (ICCS)
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. *
  16. */
  17. /**
  18. * @file allocator.h
  19. * @author Ioannis Koutras (joko@microlab.ntua.gr)
  20. * @date August 2012
  21. * @brief Basic structures needed for the dmmlib allocator.
  22. */
  23. #ifndef ALLOCATOR_H
  24. #define ALLOCATOR_H
  25. #include "dmm_config.h"
  26. #include "dmmlib/raw_block.h"
  27. #ifdef HAVE_LOCKS
  28. #include <pthread.h>
  29. #endif /* HAVE_LOCKS */
  30. /** The allocator structure of dmmlib. */
  31. typedef struct allocator_s {
  32. raw_block_header_t *raw_block_head; /**< The head of the raw blocks list. */
  33. #ifdef HAVE_LOCKS
  34. pthread_mutex_t creation_mutex; /**< Mutex to allow the creation of new raw
  35. blocks. */
  36. #endif /* HAVE_LOCKS */
  37. } allocator_t;
  38. #endif /* ALLOCATOR_H */