]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
freetdm: set sched API as not available for Windows
authorMoises Silva <moy@sangoma.com>
Thu, 27 May 2010 19:37:29 +0000 (15:37 -0400)
committerMoises Silva <moy@sangoma.com>
Thu, 27 May 2010 19:37:29 +0000 (15:37 -0400)
libs/freetdm/msvc/freetdm.2008.vcproj
libs/freetdm/src/ftdm_sched.c

index 2fb9b9ba253df13d8b7594913637331af875cab9..851017e9a82abfa16affb981e7273feef6830dda 100644 (file)
                        />\r
                </Configuration>\r
                <Configuration\r
-                       Name="Debug|x64"\r
-                       OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"\r
-                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
+                       Name="Release|Win32"\r
+                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
+                       IntermediateDirectory="$(ConfigurationName)"\r
                        ConfigurationType="2"\r
                        CharacterSet="2"\r
+                       WholeProgramOptimization="1"\r
                        BuildLogFile="$(IntDir)\BuildLog-freetdm.htm"\r
                        >\r
                        <Tool\r
                        />\r
                        <Tool\r
                                Name="VCMIDLTool"\r
-                               TargetEnvironment="3"\r
                        />\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
-                               Optimization="0"\r
                                AdditionalIncludeDirectories="../src/include;../src/include/private;../src/isdn/include"\r
-                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS"\r
-                               MinimalRebuild="true"\r
-                               BasicRuntimeChecks="3"\r
-                               RuntimeLibrary="3"\r
+                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS"\r
+                               RuntimeLibrary="2"\r
                                DisableLanguageExtensions="false"\r
                                RuntimeTypeInfo="false"\r
                                UsePrecompiledHeader="0"\r
                        />\r
                        <Tool\r
                                Name="VCLinkerTool"\r
-                               GenerateDebugInformation="true"\r
-                               TargetMachine="17"\r
                        />\r
                        <Tool\r
                                Name="VCALinkTool"\r
                        />\r
                </Configuration>\r
                <Configuration\r
-                       Name="Release|Win32"\r
-                       OutputDirectory="$(SolutionDir)$(ConfigurationName)"\r
-                       IntermediateDirectory="$(ConfigurationName)"\r
+                       Name="Debug|x64"\r
+                       OutputDirectory="$(SolutionDir)$(PlatformName)\$(ConfigurationName)"\r
+                       IntermediateDirectory="$(PlatformName)\$(ConfigurationName)"\r
                        ConfigurationType="2"\r
                        CharacterSet="2"\r
-                       WholeProgramOptimization="1"\r
                        BuildLogFile="$(IntDir)\BuildLog-freetdm.htm"\r
                        >\r
                        <Tool\r
                        />\r
                        <Tool\r
                                Name="VCMIDLTool"\r
+                               TargetEnvironment="3"\r
                        />\r
                        <Tool\r
                                Name="VCCLCompilerTool"\r
+                               Optimization="0"\r
                                AdditionalIncludeDirectories="../src/include;../src/include/private;../src/isdn/include"\r
-                               PreprocessorDefinitions="WIN32;NDEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS"\r
-                               RuntimeLibrary="2"\r
+                               PreprocessorDefinitions="WIN32;_DEBUG;_LIB;_CRT_SECURE_NO_WARNINGS;FREETDM_EXPORTS;TELETONE_EXPORTS"\r
+                               MinimalRebuild="true"\r
+                               BasicRuntimeChecks="3"\r
+                               RuntimeLibrary="3"\r
                                DisableLanguageExtensions="false"\r
                                RuntimeTypeInfo="false"\r
                                UsePrecompiledHeader="0"\r
                        />\r
                        <Tool\r
                                Name="VCLinkerTool"\r
+                               GenerateDebugInformation="true"\r
+                               TargetMachine="17"\r
                        />\r
                        <Tool\r
                                Name="VCALinkTool"\r
                                RelativePath="..\src\include\ftdm_os.h"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\src\include\private\ftdm_sched.h"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\src\include\ftdm_threadmutex.h"\r
                                >\r
                                RelativePath="..\src\ftdm_queue.c"\r
                                >\r
                        </File>\r
+                       <File\r
+                               RelativePath="..\src\ftdm_sched.c"\r
+                               >\r
+                       </File>\r
                        <File\r
                                RelativePath="..\src\ftdm_threadmutex.c"\r
                                >\r
index 10332a078734bb679930bc187de041ac513282d6..3d5ddcd4c956fe4b13d0d43800b7bd5bfc245d57 100644 (file)
@@ -68,6 +68,10 @@ static void *run_main_schedule(ftdm_thread_t *thread, void *data)
        int32_t sleepms;
        ftdm_status_t status;
        ftdm_sched_t *current = NULL;
+#ifdef __WINDOWS__
+       UNREFERENCED_PARAMETER(data);
+       UNREFERENCED_PARAMETER(thread);
+#endif
        while (ftdm_running()) {
                
                sleepms = SCHED_MAX_SLEEP;
@@ -121,7 +125,7 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_global_init()
 
 FT_DECLARE(ftdm_status_t) ftdm_sched_free_run(ftdm_sched_t *sched)
 {
-       ftdm_status_t status;
+       ftdm_status_t status = FTDM_FAIL;
        ftdm_assert_return(sched != NULL, FTDM_EINVAL, "invalid pointer\n");
 
        ftdm_mutex_lock(sched_globals.mutex);
@@ -137,6 +141,7 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_free_run(ftdm_sched_t *sched)
        }
 
        ftdm_log(FTDM_LOG_DEBUG, "Running schedule %s in the main schedule thread\n", sched->name);
+       status = FTDM_SUCCESS;
        
        /* Add the schedule to the global list of free runs */
        if (!sched_globals.freeruns) {
@@ -196,27 +201,21 @@ failed:
 FT_DECLARE(ftdm_status_t) ftdm_sched_run(ftdm_sched_t *sched)
 {
        ftdm_status_t status = FTDM_FAIL;
+#ifdef __linux__
        ftdm_timer_t *runtimer;
        ftdm_timer_t *timer;
        ftdm_sched_callback_t callback;
        int ms = 0;
        int rc = -1;
        void *data;
-#ifdef __linux__
        struct timeval now;
-#else
-       ftdm_log(FTDM_LOG_CRIT, "Not implemented in this platform\n");
-       return FTDM_NOTIMPL;
-#endif
        ftdm_assert_return(sched != NULL, FTDM_EINVAL, "sched is null!\n");
 
        ftdm_mutex_lock(sched->mutex);
 
 tryagain:
 
-#ifdef __linux__
        rc = gettimeofday(&now, NULL);
-#endif
        if (rc == -1) {
                ftdm_log(FTDM_LOG_ERROR, "Failed to retrieve time of day\n");
                goto done;
@@ -227,10 +226,8 @@ tryagain:
                runtimer = timer;
                timer = runtimer->next;
 
-#ifdef __linux__
                ms = ((runtimer->time.tv_sec - now.tv_sec) * 1000) +
                     ((runtimer->time.tv_usec - now.tv_usec) / 1000);
-#endif
 
                if (ms <= 0) {
 
@@ -264,6 +261,13 @@ tryagain:
 done:
 
        ftdm_mutex_unlock(sched->mutex);
+#else
+       ftdm_log(FTDM_LOG_CRIT, "Not implemented in this platform\n");
+       status = FTDM_NOTIMPL;
+#endif
+#ifdef __WINDOWS__
+       UNREFERENCED_PARAMETER(sched);
+#endif
 
        return status;
 }
@@ -271,12 +275,11 @@ done:
 FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name, 
                int ms, ftdm_sched_callback_t callback, void *data, ftdm_timer_t **timer)
 {
+       ftdm_status_t status = FTDM_FAIL;
 #ifdef __linux__
        struct timeval now;
-#endif
        int rc = 0;
        ftdm_timer_t *newtimer;
-       ftdm_status_t status = FTDM_FAIL;
 
        ftdm_assert_return(sched != NULL, FTDM_EINVAL, "sched is null!\n");
        ftdm_assert_return(name != NULL, FTDM_EINVAL, "timer name is null!\n");
@@ -287,12 +290,7 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name
                *timer = NULL;
        }
 
-#ifdef __linux__
        rc = gettimeofday(&now, NULL);
-#else
-       ftdm_log(FTDM_LOG_CRIT, "Not implemented in this platform\n");
-       return FTDM_NOTIMPL;
-#endif
        if (rc == -1) {
                ftdm_log(FTDM_LOG_ERROR, "Failed to retrieve time of day\n");
                return FTDM_FAIL;
@@ -309,14 +307,12 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name
        newtimer->callback = callback;
        newtimer->usrdata = data;
 
-#ifdef __linux__
        newtimer->time.tv_sec = now.tv_sec + (ms / 1000);
        newtimer->time.tv_usec = now.tv_usec + (ms % 1000) * 1000;
        if (newtimer->time.tv_usec >= FTDM_MICROSECONDS_PER_SECOND) {
                newtimer->time.tv_sec += 1;
                newtimer->time.tv_usec -= FTDM_MICROSECONDS_PER_SECOND;
        }
-#endif
 
        if (!sched->timers) {
                sched->timers = newtimer;
@@ -333,33 +329,40 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_timer(ftdm_sched_t *sched, const char *name
 done:
 
        ftdm_mutex_unlock(sched->mutex);
+#else
+       ftdm_log(FTDM_LOG_CRIT, "Not implemented in this platform\n");
+       status = FTDM_NOTIMPL;
+#endif
+#ifdef __WINDOWS__
+       UNREFERENCED_PARAMETER(sched);
+       UNREFERENCED_PARAMETER(name);
+       UNREFERENCED_PARAMETER(ms);
+       UNREFERENCED_PARAMETER(callback);
+       UNREFERENCED_PARAMETER(data);
+       UNREFERENCED_PARAMETER(timer);
+#endif
        return status;
 }
 
 FT_DECLARE(ftdm_status_t) ftdm_sched_get_time_to_next_timer(const ftdm_sched_t *sched, int32_t *timeto)
 {
        ftdm_status_t status = FTDM_FAIL;
+#ifdef __linux__
        int res = -1;
        int ms = 0;
-#ifdef __linux__
        struct timeval currtime;
-#endif
        ftdm_timer_t *current = NULL;
        ftdm_timer_t *winner = NULL;
        
        /* forever by default */
        *timeto = -1;
 
-#ifndef __linux__
        ftdm_log(FTDM_LOG_ERROR, "Implement me!\n");
        return FTDM_NOTIMPL;
-#endif
 
        ftdm_mutex_lock(sched->mutex);
 
-#ifdef __linux__
        res = gettimeofday(&currtime, NULL);
-#endif
        if (-1 == res) {
                ftdm_log(FTDM_LOG_ERROR, "Failed to get next event time\n");
                goto done;
@@ -396,6 +399,11 @@ FT_DECLARE(ftdm_status_t) ftdm_sched_get_time_to_next_timer(const ftdm_sched_t *
 
 done:
        ftdm_mutex_unlock(sched->mutex);
+#endif
+#ifdef __WINDOWS__
+       UNREFERENCED_PARAMETER(timeto);
+       UNREFERENCED_PARAMETER(sched);
+#endif
 
        return status;
 }