Exemple #1
0
static void* allocate(std::size_t n) {
	if (n >= cache_line_size) {
		return big_alloc.allocate(n);
	} else {
		return small_alloc.allocate(n);
	}
}
Exemple #2
0
        virtual void on_scheduler_entry( bool is_worker )
        {
            assert(tls_thread_index == 0);
            tls_thread_index = thread_next_index++;
            assert( thread_next_index <= THREADID_MAX );
            printf("new thread appears, with id: %u\n", tls_thread_index);

            assert(thread_aborts[tls_thread_index] == NULL);
            thread_aborts[tls_thread_index] = abort_allocator.allocate(sizeof(bool));
            assert(tls_thread_abort == NULL);
            tls_thread_abort = thread_aborts[tls_thread_index];
            *tls_thread_abort = false;

            assert(tls_private_sgraph_set == NULL);
            tls_private_sgraph_set = new PrivateSeqGraphSet();

            tls_kmernode_allocator = g__KMERNODE_ALLOCATOR->GetTlsAllocator(tls_thread_index);
            tls_seqnode_allocator = g__SEQNODE_ALLOCATOR->GetTlsAllocator(tls_thread_index);
        }