Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
9EOR9 committed Oct 6, 2016
2 parents 6723c52 + fcb8da5 commit b98083c
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 24 deletions.
28 changes: 16 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,20 @@ IF(COMMAND CMAKE_POLICY)
ENDFOREACH()
ENDIF()

IF (NOT DEFINED CMAKE_PROJECT_NAME)
# Standalone project
PROJECT(mariadb-connector-c C)
ELSE()
# do not inherit include directories from the parent project
SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
FOREACH(V WITH_MYSQLCOMPAT WITH_MSI WITH_SIGNCODE WITH_RTC WITH_UNITTEST
WITH_DYNCOL WITH_EXTERNAL_ZLIB WITH_CURL WITH_SQLITE WITH_SSL
INSTALL_LAYOUT WITH_TEST_SRCPKG)
SET(${V} ${${OPT}${V}})
ENDFOREACH()
ENDIF()

PROJECT(mariadb-connector-c C)

# Is C/C built as subproject?
get_directory_property(IS_SUBPROJECT PARENT_DIRECTORY)

# do not inherit include directories from the parent project
SET_PROPERTY(DIRECTORY PROPERTY INCLUDE_DIRECTORIES)
FOREACH(V WITH_MYSQLCOMPAT WITH_MSI WITH_SIGNCODE WITH_RTC WITH_UNITTEST
WITH_DYNCOL WITH_EXTERNAL_ZLIB WITH_CURL WITH_SQLITE WITH_SSL
INSTALL_LAYOUT WITH_TEST_SRCPKG)
SET(${V} ${${OPT}${V}})
ENDFOREACH()


SET(PACKAGE_STATUS_SUFFIX "alpha")

Expand Down Expand Up @@ -104,6 +106,7 @@ IF(WIN32)
INCLUDE(${CC_SOURCE_DIR}/cmake/version_info.cmake)
ENDIF()

IF(NOT IS_SUBPROJECT)
IF(MSVC)
# Speedup system tests
INCLUDE(${CC_SOURCE_DIR}/cmake/WindowsCache.cmake)
Expand All @@ -127,6 +130,7 @@ IF(MSVC)
ENDFOREACH()
ENDIF()
ENDIF()
ENDIF(NOT IS_SUBPROJECT)

# Disable dbug information for release builds
SET(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DDBUG_OFF")
Expand Down
3 changes: 3 additions & 0 deletions include/ma_global.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@
#define sleep(x) Sleep(1000*(x))
#ifdef _MSC_VER
#define inline __inline
#if _MSC_VER < 1900
#define snprintf _snprintf
#endif
#endif
#define STDCALL __stdcall
#endif
Expand Down
15 changes: 3 additions & 12 deletions libmariadb/ma_context.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,25 +675,16 @@ my_context_destroy(struct my_context *c)
int
my_context_spawn(struct my_context *c, void (*f)(void *), void *d)
{
void *current_fiber;
c->user_func= f;
c->user_arg= d;
/*
This seems to be a common trick to run ConvertThreadToFiber() only on the
first occurence in a thread, in a way that works on multiple Windows
versions.
*/
current_fiber= GetCurrentFiber();
if (current_fiber == NULL || current_fiber == (void *)0x1e00)
current_fiber= ConvertThreadToFiber(c);
c->app_fiber= current_fiber;
SwitchToFiber(c->lib_fiber);
return c->return_value;
return my_context_continue(c);
}

int
my_context_continue(struct my_context *c)
{
void *current_fiber= IsThreadAFiber() ? GetCurrentFiber() : ConvertThreadToFiber(c);
c->app_fiber= current_fiber;
SwitchToFiber(c->lib_fiber);
return c->return_value;
}
Expand Down

0 comments on commit b98083c

Please sign in to comment.