Fix problem with Windows Threads

This commit is contained in:
lexborisov 2017-03-12 18:05:22 +03:00
parent de800aeeb8
commit e215019c09
24 changed files with 46 additions and 38 deletions

View File

@ -45,9 +45,13 @@ MODEST_DIR_SEPARATOR ?= /
# names
# This variables used with "call" $(call MODEST_LIBRARY_WITH_VERSION),
# for use actual variables like a LIB_NAME_SUFFIX
MODEST_LIBRARY ?= $(LIB_DIR_BASE)/lib$(LIB_NAME)$(LIB_NAME_SUFFIX)
MODEST_LIBRARY_STATIC ?= $(LIB_DIR_BASE)/lib$(LIB_NAME)$(LIB_NAME_SUFFIX_STATIC)
MODEST_LIBRARY_WITH_VERSION = $(LIB_DIR_BASE)/lib$(LIB_NAME).$(MODEST_VERSION_STRING)$(LIB_NAME_SUFFIX)
MODEST_LIBRARY_NAME ?= lib$(LIB_NAME)$(LIB_NAME_SUFFIX)
MODEST_LIBRARY_NAME_STATIC ?=lib$(LIB_NAME)$(LIB_NAME_SUFFIX_STATIC)
MODEST_LIBRARY_NAME_WITH_VERSION = lib$(LIB_NAME).$(MODEST_VERSION_STRING)$(LIB_NAME_SUFFIX)
MODEST_LIBRARY ?= $(LIB_DIR_BASE)/$(MODEST_LIBRARY_NAME)
MODEST_LIBRARY_STATIC ?= $(LIB_DIR_BASE)/$(MODEST_LIBRARY_NAME_STATIC)
MODEST_LIBRARY_WITH_VERSION = $(LIB_DIR_BASE)/$(MODEST_LIBRARY_NAME_WITH_VERSION)
MODEST_PORT_NAME ?= posix

View File

@ -63,7 +63,7 @@ BINARY_BUILD_EXECUTE_CLEAN := $(foreach path,$(BINARY_BUILD_EXECUTE),$(subst ./,
BINARY_BUILD_EXECUTE_TO_CLEAN := $(foreach path,$(BINARY_BUILD_EXECUTE_CLEAN),rm -f $(BINARY_TO_DIR)/$(path) $(BYNARY_UTILS_NEW_LINE))
BINARY_BUILD_DIRS_TO_CLEAN := $(foreach path,$(BINARY_BUILD_MODULES_LIST),rm -rf $(BINARY_TO_DIR)/$(path) $(BYNARY_UTILS_NEW_LINE))
BINARY_BUILD_EXECUTE_COPY := $(foreach path,$(BINARY_BUILD_EXECUTE_CLEAN),cp $(path) $(BINARY_TO_DIR)/$(dir $(path)) $(BYNARY_UTILS_NEW_LINE))
BINARY_BUILD_EXECUTE_COPY_ALL := $(BINARY_UTILS_CREATE_DIRS) $(BINARY_BUILD_EXECUTE_COPY)
BINARY_BUILD_EXECUTE_COPY_ALL := $(BINARY_UTILS_CREATE_DIRS) $(BINARY_BUILD_EXECUTE_COPY) cp $(BINARY_PATH_RELATIVE)/$(call MODEST_LIBRARY_WITH_VERSION) $(BINARY_TO_DIR)
#********************
# Target options
@ -76,6 +76,7 @@ build: $(BINARY_BUILD_EXECUTE_CLEAN)
clean: $(BINARY_BUILD_MODULES_TARGET_CLEAN)
$(BINARY_BUILD_EXECUTE_TO_CLEAN)
$(BINARY_BUILD_DIRS_TO_CLEAN)
rm -f $(BINARY_TO_DIR)/$(call MODEST_LIBRARY_NAME_WITH_VERSION)
copy:
$(BINARY_BUILD_EXECUTE_COPY_ALL)

View File

@ -33,15 +33,10 @@
#define MyCORE_VERSION_MINOR 0
#define MyCORE_VERSION_PATCH 0
#define MyCORE_BUILD_WITHOUT_THREADS
//#define MyCORE_BUILD_WITHOUT_THREADS
#ifdef __cplusplus
//extern "C" {
#endif
#if (defined(_WIN32) || defined(_WIN64)) && !defined(__WINPTHREADS_VERSION)
#define IS_OS_WINDOWS
#include <windows.h>
extern "C" {
#endif
/* Format */

View File

@ -23,7 +23,7 @@
#pragma once
#ifdef __cplusplus
//extern "C" {
extern "C" {
#endif
#include <mycore/myosi.h>

View File

@ -26,7 +26,7 @@
#include <mycore/mythread.h>
#ifdef __cplusplus
//extern "C" {
extern "C" {
#endif
// queue

View File

@ -21,6 +21,8 @@
#ifndef MyCORE_UTILS_MHASH_H
#define MyCORE_UTILS_MHASH_H
#include <string.h>
#include <mycore/myosi.h>
#include <mycore/utils/mchar_async.h>

View File

@ -32,6 +32,7 @@ typedef struct mycss_media mycss_media_t;
struct mycss_media {
mystatus_t error;
};

View File

@ -23,9 +23,11 @@
#pragma once
#ifdef __cplusplus
//extern "C" {
extern "C" {
#endif
#include <string.h>
#include <myencoding/myosi.h>
#include <mycore/utils.h>
#include <mycore/mystring.h>

View File

@ -29,7 +29,7 @@
#define MyENCODING_VERSION_PATCH 0
#ifdef __cplusplus
//extern "C" {
extern "C" {
#endif
// encoding

View File

@ -23,7 +23,7 @@
#pragma once
#ifdef __cplusplus
//extern "C" {
extern "C" {
#endif
#include <myencoding/myosi.h>

View File

@ -22,6 +22,8 @@
#define MyFONT_MyFONT_H
#pragma once
#include <string.h>
#include <myfont/myosi.h>
#include <myfont/cmap.h>
#include <myfont/head.h>

View File

@ -23,7 +23,7 @@
#pragma once
#ifdef __cplusplus
//extern "C" {
extern "C" {
#endif
#include <myhtml/myosi.h>

View File

@ -159,7 +159,7 @@ bool modest_finder_selector_sub_type_pseudo_class_function_nth_child_check_selec
bool modest_finder_selector_sub_type_pseudo_class_function_nth_child(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
{
if(selector->value == NULL)
return NULL;
return false;
mycss_an_plus_b_entry_t *anb = mycss_selector_value_an_plus_b(selector->value);
@ -226,7 +226,7 @@ bool modest_finder_selector_sub_type_pseudo_class_function_nth_column(modest_fin
bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_child(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
{
if(selector->value == NULL)
return NULL;
return false;
mycss_an_plus_b_entry_t *anb = mycss_selector_value_an_plus_b(selector->value);
@ -290,7 +290,7 @@ bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_column(modes
bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_of_type(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
{
if(selector->value == NULL)
return NULL;
return false;
mycss_an_plus_b_entry_t *anb = mycss_selector_value_an_plus_b(selector->value);
@ -322,7 +322,7 @@ bool modest_finder_selector_sub_type_pseudo_class_function_nth_last_of_type(mode
bool modest_finder_selector_sub_type_pseudo_class_function_nth_of_type(modest_finder_t* finder, myhtml_tree_node_t* base_node, mycss_selectors_entry_t* selector, mycss_selectors_specificity_t* spec)
{
if(selector->value == NULL)
return NULL;
return false;
mycss_an_plus_b_entry_t *anb = mycss_selector_value_an_plus_b(selector->value);

View File

@ -36,7 +36,7 @@
//#define MyCORE_BUILD_WITHOUT_THREADS
#ifdef __cplusplus
//extern "C" {
extern "C" {
#endif
/* Format */

View File

@ -23,7 +23,7 @@
#pragma once
#ifdef __cplusplus
//extern "C" {
extern "C" {
#endif
#include "mycore/myosi.h"

View File

@ -26,7 +26,7 @@
#include "mycore/mythread.h"
#ifdef __cplusplus
//extern "C" {
extern "C" {
#endif
// queue

View File

@ -32,6 +32,7 @@ typedef struct mycss_media mycss_media_t;
struct mycss_media {
mystatus_t error;
};

View File

@ -29,7 +29,7 @@
#define MyENCODING_VERSION_PATCH 0
#ifdef __cplusplus
//extern "C" {
extern "C" {
#endif
// encoding

View File

@ -23,7 +23,7 @@
#pragma once
#ifdef __cplusplus
//extern "C" {
extern "C" {
#endif
#include "myencoding/myosi.h"

View File

@ -23,7 +23,7 @@
#pragma once
#ifdef __cplusplus
//extern "C" {
extern "C" {
#endif
#include "myhtml/myosi.h"

View File

@ -31,9 +31,9 @@
***********************************************************************************/
void * mythread_thread_create(mythread_t *mythread, void* process_func, void* ctx)
{
pthread_t thread;
void *thread = mycore_calloc(1, sizeof(pthread_t));
if(pthread_create(&thread, mythread->attr, process_func, ctx) == 0)
if(pthread_create(&(*((pthread_t*)thread)), mythread->attr, process_func, ctx) == 0)
return thread;
return NULL;

View File

@ -22,7 +22,7 @@
#include <stdarg.h>
/* FILE */
FILE * mycore_fopen(const char *restrict filename, const char *restrict mode)
FILE * mycore_fopen(const char* filename, const char* mode)
{
return fopen(filename, mode);
}
@ -32,12 +32,12 @@ int mycore_fclose(FILE *stream)
return fclose(stream);
}
size_t mycore_fread(void *restrict buffer, size_t size, size_t count, FILE *restrict stream)
size_t mycore_fread(void *buffer, size_t size, size_t count, FILE* stream)
{
return fread(buffer, size, count, stream);
}
size_t mycore_fwrite(const void *restrict buffer, size_t size, size_t count, FILE *restrict stream)
size_t mycore_fwrite(const void* buffer, size_t size, size_t count, FILE* stream)
{
return fwrite(buffer, size, count, stream);
}
@ -53,9 +53,9 @@ int mycore_ferror(FILE *stream)
}
/* setbuf */
void mycore_setbuf(FILE *restrict stream, char *restrict buffer)
void mycore_setbuf(FILE* stream, char* buffer)
{
return setbuf(stream, buffer);
setbuf(stream, buffer);
}

View File

@ -64,7 +64,7 @@ mystatus_t mythread_thread_destroy(mythread_t *mythread, void* thread)
void * mythread_thread_attr_init(mythread_t *mythread)
{
return MyCORE_STATUS_OK;
return (void*)0x01;
}
void mythread_thread_attr_clean(mythread_t *mythread, void* attr)
@ -111,7 +111,7 @@ void mythread_mutex_close(mythread_t *mythread, void* mutex)
void * mythread_nanosleep_create(mythread_t* mythread)
{
return NULL;
return (void*)0x01;
}
void mythread_nanosleep_clean(void* timespec)
@ -125,7 +125,7 @@ void mythread_nanosleep_destroy(void* timespec)
mystatus_t mythread_nanosleep_sleep(void* timespec)
{
Sleep(0);
return MyCORE_STATUS_ERROR;
return MyCORE_STATUS_OK;
}
#endif

View File

@ -69,7 +69,7 @@ mcsync_status_t mcsync_spin_unlock(void* spinlock)
/* mutex */
void * mcsync_mutex_create(void)
{
return CreateSemaphore(NULL, 0, 1, NULL);
return CreateSemaphore(NULL, 1, 1, NULL);
}
mcsync_status_t mcsync_mutex_init(void* mutex)