Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Third Party Harfbuzz
提交
cdafe3a7
T
Third Party Harfbuzz
项目概览
OpenHarmony
/
Third Party Harfbuzz
大约 1 年 前同步成功
通知
0
Star
18
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
T
Third Party Harfbuzz
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
cdafe3a7
编写于
6月 05, 2012
作者:
B
Behdad Esfahbod
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add gcc intrinsics implementations for atomic and mutex
上级
d970d289
变更
5
隐藏空白更改
内联
并排
Showing
5 changed file
with
65 addition
and
19 deletion
+65
-19
configure.ac
configure.ac
+2
-2
src/hb-atomic-private.hh
src/hb-atomic-private.hh
+9
-2
src/hb-mutex-private.hh
src/hb-mutex-private.hh
+44
-7
src/hb-object-private.hh
src/hb-object-private.hh
+3
-1
src/hb-warning.cc
src/hb-warning.cc
+7
-7
未找到文件。
configure.ac
浏览文件 @
cdafe3a7
...
...
@@ -52,8 +52,8 @@ AC_SUBST(HB_LIBTOOL_VERSION_INFO)
dnl GTK_DOC_CHECK([1.15],[--flavour no-tmpl])
# Functions and headers
AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize mmap _setmode isatty)
AC_CHECK_HEADERS(unistd.h sys/mman.h io.h)
AC_CHECK_FUNCS(atexit mprotect sysconf getpagesize
sched_yield
mmap _setmode isatty)
AC_CHECK_HEADERS(unistd.h sys/mman.h
sched.h
io.h)
# Compiler flags
AC_CANONICAL_HOST
...
...
src/hb-atomic-private.hh
浏览文件 @
cdafe3a7
...
...
@@ -72,13 +72,20 @@ typedef int hb_atomic_int_t;
#endif
#else
#elif !defined(HB_NO_MT)
#define HB_ATOMIC_INT_NIL 1
/* Warn that fallback implementation is in use. */
typedef
volatile
int
hb_atomic_int_t
;
#define hb_atomic_int_add(AI, V) (((AI) += (V)) - (V))
#else
/* HB_NO_MT */
#define HB_ATOMIC_INT_NIL 1
typedef
int
hb_atomic_int_t
;
#define hb_atomic_int_add(AI, V) (((AI) += (V)) - (V))
#endif
/* TODO Add tracing. */
#endif
/* HB_ATOMIC_PRIVATE_HH */
src/hb-mutex-private.hh
浏览文件 @
cdafe3a7
/*
* Copyright © 2007 Chris Wilson
* Copyright © 2009,2010 Red Hat, Inc.
* Copyright © 2011 Google, Inc.
* Copyright © 2011
,2012
Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
...
...
@@ -53,7 +53,7 @@ typedef CRITICAL_SECTION hb_mutex_impl_t;
#define hb_mutex_impl_finish(M) DeleteCriticalSection (M)
#elif !defined(HB_NO_MT) &&
defined(__APPLE__
)
#elif !defined(HB_NO_MT) &&
(defined(HAVE_PTHREAD) || defined(__APPLE__)
)
#include <pthread.h>
typedef
pthread_mutex_t
hb_mutex_impl_t
;
...
...
@@ -75,15 +75,50 @@ typedef GStaticMutex hb_mutex_impl_t;
#define hb_mutex_impl_finish(M) g_static_mutex_free (M)
#elif !defined(HB_NO_MT) && defined(__GNUC__)
#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_YIELD)
# include <sched.h>
# define HB_SCHED_YIELD() sched_yield ()
#else
# define HB_SCHED_YIELD() HB_STMT_START {} HB_STMT_END
#endif
#define HB_MUTEX_IMPL_NIL 1
/* This actually is not a totally awful implementation. */
typedef
volatile
int
hb_mutex_impl_t
;
#define HB_MUTEX_IMPL_INIT 0
#define hb_mutex_impl_init(M) ((void) (*(M) = 0))
#define hb_mutex_impl_lock(M) ((void) (*(M) = 1))
#define hb_mutex_impl_unlock(M) ((void) (*(M) = 0))
#define hb_mutex_impl_finish(M) ((void) (*(M) = 2))
#define hb_mutex_impl_init(M) *(M) = 0
#define hb_mutex_impl_lock(M) HB_STMT_START { while (__sync_lock_test_and_set((M), 1)) HB_SCHED_YIELD (); } HB_STMT_END
#define hb_mutex_impl_unlock(M) __sync_lock_release (M)
#define hb_mutex_impl_finish(M) HB_STMT_START {} HB_STMT_END
#elif !defined(HB_NO_MT)
#if defined(HAVE_SCHED_H) && defined(HAVE_SCHED_YIELD)
# include <sched.h>
# define HB_SCHED_YIELD() sched_yield ()
#else
# define HB_SCHED_YIELD() HB_STMT_START {} HB_STMT_END
#endif
#define HB_MUTEX_INT_NIL 1
/* Warn that fallback implementation is in use. */
typedef
volatile
int
hb_mutex_impl_t
;
#define HB_MUTEX_IMPL_INIT 0
#define hb_mutex_impl_init(M) *(M) = 0
#define hb_mutex_impl_lock(M) HB_STMT_START { while (*(M)) HB_SCHED_YIELD (); (*(M))++; } HB_STMT_END
#define hb_mutex_impl_unlock(M) (*(M))--;
#define hb_mutex_impl_finish(M) HB_STMT_START {} HB_STMT_END
#else
/* HB_NO_MT */
typedef
int
hb_mutex_impl_t
;
#define HB_MUTEX_IMPL_INIT 0
#define hb_mutex_impl_init(M) HB_STMT_START {} HB_STMT_END
#define hb_mutex_impl_lock(M) HB_STMT_START {} HB_STMT_END
#define hb_mutex_impl_unlock(M) HB_STMT_START {} HB_STMT_END
#define hb_mutex_impl_finish(M) HB_STMT_START {} HB_STMT_END
#endif
...
...
@@ -91,6 +126,8 @@ typedef volatile int hb_mutex_impl_t;
#define HB_MUTEX_INIT {HB_MUTEX_IMPL_INIT}
struct
hb_mutex_t
{
/* TODO Add tracing. */
hb_mutex_impl_t
m
;
inline
void
init
(
void
)
{
hb_mutex_impl_init
(
&
m
);
}
...
...
src/hb-object-private.hh
浏览文件 @
cdafe3a7
/*
* Copyright © 2007 Chris Wilson
* Copyright © 2009,2010 Red Hat, Inc.
* Copyright © 2011 Google, Inc.
* Copyright © 2011
,2012
Google, Inc.
*
* This is part of HarfBuzz, a text shaping library.
*
...
...
@@ -68,6 +68,8 @@ struct hb_reference_count_t
#define HB_USER_DATA_ARRAY_INIT {HB_LOCKABLE_SET_INIT}
struct
hb_user_data_array_t
{
/* TODO Add tracing. */
struct
hb_user_data_item_t
{
hb_user_data_key_t
*
key
;
void
*
data
;
...
...
src/hb-warning.cc
浏览文件 @
cdafe3a7
...
...
@@ -28,23 +28,23 @@
#include "hb-mutex-private.hh"
#if
!defined(HB_NO_MT) &&
defined(HB_ATOMIC_INT_NIL)
#if defined(HB_ATOMIC_INT_NIL)
#ifdef _MSC_VER
#pragma message("Could not find any system to define atomic_int macros, library
will
NOT be thread-safe")
#pragma message("Could not find any system to define atomic_int macros, library
may
NOT be thread-safe")
#else
#warning "Could not find any system to define atomic_int macros, library
will
NOT be thread-safe"
#warning "Could not find any system to define atomic_int macros, library
may
NOT be thread-safe"
#endif
#endif
#if
!defined(HB_NO_MT) &&
defined(HB_MUTEX_IMPL_NIL)
#if defined(HB_MUTEX_IMPL_NIL)
#ifdef _MSC_VER
#pragma message("Could not find any system to define mutex macros, library
will
NOT be thread-safe")
#pragma message("Could not find any system to define mutex macros, library
may
NOT be thread-safe")
#else
#warning "Could not find any system to define mutex macros, library
will
NOT be thread-safe"
#warning "Could not find any system to define mutex macros, library
may
NOT be thread-safe"
#endif
#endif
#if
!defined(HB_NO_MT) && (defined(HB_ATOMIC_INT_NIL) || defined(HB_MUTEX_IMPL_NIL)
)
#if
defined(HB_ATOMIC_INT_NIL) || defined(HB_MUTEX_IMPL_NIL
)
#ifdef _MSC_VER
#pragma message("To suppress these warnings, define HB_NO_MT")
#else
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录