Use iothread_perform variant that doesn't take a completion callback

Removes some ugly NULL casts
This commit is contained in:
ridiculousfish 2015-01-08 11:02:40 -08:00
parent 6e2132e01f
commit 20974edc14
2 changed files with 4 additions and 3 deletions

View File

@ -526,7 +526,7 @@ static void test_iothread(void)
double start = timef();
for (int i=0; i < iterations; i++)
{
int thread_count = iothread_perform(test_iothread_thread_call, (void (*)(int *, int))NULL, int_ptr);
int thread_count = iothread_perform(test_iothread_thread_call, int_ptr);
max_achieved_thread_count = std::max(max_achieved_thread_count, thread_count);
}
@ -776,7 +776,7 @@ static void test_1_cancellation(const wchar_t *src)
shared_ptr<io_buffer_t> out_buff(io_buffer_t::create(STDOUT_FILENO, io_chain_t()));
const io_chain_t io_chain(out_buff);
test_cancellation_info_t ctx = {pthread_self(), 0.25 /* seconds */ };
iothread_perform(signal_main, (void (*)(test_cancellation_info_t *, int))NULL, &ctx);
iothread_perform(signal_main, &ctx);
parser_t::principal_parser().eval(src, io_chain, TOP);
out_buff->read();
if (out_buff->out_buffer_size() != 0)
@ -2424,7 +2424,7 @@ static void test_universal()
const int threads = 16;
for (int i=0; i < threads; i++)
{
iothread_perform(test_universal_helper, (void (*)(int *, int))NULL, new int(i));
iothread_perform(test_universal_helper, new int(i));
}
iothread_drain_all();

View File

@ -38,6 +38,7 @@ int iothread_perform(int (*handler)(T *), void (*completionCallback)(T *, int),
return iothread_perform_base((int (*)(void *))handler, (void (*)(void *, int))completionCallback, static_cast<void *>(context));
}
/* Variant that takes no completion callback */
template<typename T>
int iothread_perform(int (*handler)(T *), T *context)
{