Skip to content

Commit

Permalink
Use iothread_perform variant that doesn't take a completion callback
Browse files Browse the repository at this point in the history
Removes some ugly NULL casts
  • Loading branch information
ridiculousfish committed Jan 14, 2015
1 parent 6e2132e commit 20974ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fish_tests.cpp
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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();

Expand Down
1 change: 1 addition & 0 deletions iothread.h
Expand Up @@ -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)
{
Expand Down

0 comments on commit 20974ed

Please sign in to comment.