N-sim
Emulation and simulation of
Wireless Sensor Networks



   Home


   Project Page


   Download


   CVS



   Installation


   Configuration


   Plug-ins




 Hosted by
SourceForge.net Logo

/home/brennan/n-sim/OrbisQuartus/control/oqctl.cpp

Go to the documentation of this file.
00001 
00014 /*
00015  * Copyright 2007. Los Alamos National Security, LLC. This material
00016  * was produced under U.S. Government contract DE-AC52-06NA25396 for
00017  * Los Alamos National Laboratory (LANL), which is operated by Los
00018  * Alamos National Security, LLC, for the Department of Energy. The
00019  * U.S. Government has rights to use, reproduce, and distribute this
00020  * software. NEITHER THE GOVERNMENT NOR LOS ALAMOS NATIONAL SECURITY,
00021  * LLC, MAKES ANY WARRANTY, EXPRESS OR IMPLIED, OR ASSUMES ANY LEGAL
00022  * LIABILITY FOR THE USE OF THIS SOFTWARE. If software is modified to
00023  * produce derivative works, such modified software should be clearly
00024  * marked, so as not to confuse it with the version available from LANL.
00025  *
00026  * Additionally, this program is free software; you can redistribute
00027  * it and/or modify it under the terms of the GNU General Public
00028  * License as published by the Free Software Foundation; version 2 of
00029  * the License. Accordingly, this program is distributed in the hope
00030  * it will be useful, but WITHOUT ANY WARRANTY; without even the
00031  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00032  * PURPOSE. See the GNU General Public License for more details.
00033  */
00034 
00035 
00036 #include <stdio.h>
00037 #include <string.h>
00038 #include <pthread.h>
00039 #include <daemon.h>
00040 #include <configuration.h>
00041 #include "ksection.h"
00042 #include "ctl_server.h"
00043 #include "mini_mpi_server.h"
00044 #include "virtual_time_server.h"
00045 
00046 
00047 extern pthread_cond_t mpi_conditional;
00048 extern pthread_mutex_t mpi_mutex;
00049 
00050 
00051 int main(int argc, char *argv[])
00052 {
00053         int rc = 0;
00054         pthread_t ctl, mpi, vt;
00055 
00056         daemon_init();
00057 
00058         pthread_mutex_init(&mpi_mutex, NULL);
00059         pthread_cond_init(&mpi_conditional, NULL);
00060 
00061         if ((rc = pthread_create(&ctl, NULL, ctl_server, NULL)) != 0) {
00062                 fprintf(stderr, "ERROR-- control server thread: %d\n", rc);
00063                 exit(-1);
00064         }
00065 
00066         if ((rc = pthread_create(&mpi, NULL, mini_mpi_server, NULL)) != 0) {
00067                 fprintf(stderr, "ERROR-- mini MPI server thread: %d\n", rc);
00068                 exit(-1);
00069         }
00070 
00071         if ((rc = pthread_create(&vt, NULL, virtual_time_server, NULL)) != 0) {
00072                 fprintf(stderr, "ERROR-- Virtual Time thread: %d\n", rc);
00073                 exit(-1);
00074         }
00075 
00076         return 0;
00077 }


© 2007, Los Alamos National Security, LLC.