#ifndef _KNN_threads_h_
#define _KNN_threads_h_

/* KNN_threads.h
 *
 * Copyright (C) 2009 Ola Söder
 *
 * This code is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 *
 * This code is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this work. If not, see <http://www.gnu.org/licenses/>.
 */

/*
 * os 20090123 First version
 * pb 2011/03/08 C++
 */

/////////////////////////////////////////////////////
//                                                 //
/////////////////////////////////////////////////////

// Error codes
enum KNN_thread_status
{
    KNN_THREAD_OK,
    KNN_THREAD_ERROR
};

// Query the number of available CPUs
int KNN_getNumberOfCPUs ();

// Distribute the work specified by 
// (*function) and input over nthreads 
// threads
void * KNN_threadDistribution
(
    void * (* function) (void *), 
    void ** input, 
    int nthreads
);

// Test threading
void KNN_threadTest ();

// Test threading aux
void * KNN_threadTestAux
(
    void * dummy
);

/* End of file KNN_threads.h */
#endif
