2000-01-28 02:49:12 +08:00
|
|
|
/* Threads compatibility routines for libgcc2. */
|
1997-12-25 07:56:08 +08:00
|
|
|
/* Compile this one with gcc. */
|
2020-01-01 19:51:42 +08:00
|
|
|
/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
|
1997-12-25 07:56:08 +08:00
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 22:35:51 +08:00
|
|
|
This file is part of GCC.
|
1997-12-25 07:56:08 +08:00
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 22:35:51 +08:00
|
|
|
GCC is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU General Public License as published by the Free
|
2009-04-09 23:00:19 +08:00
|
|
|
Software Foundation; either version 3, or (at your option) any later
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 22:35:51 +08:00
|
|
|
version.
|
1997-12-25 07:56:08 +08:00
|
|
|
|
Makefile.in, [...]: replace "GNU CC" with "GCC".
* Makefile.in, alias.c, basic-block.h, bb-reorder.c, bitmap.c,
bitmap.h, builtin-types.def, builtins.c, builtins.def,
c-aux-info.c, c-common.c, c-common.def, c-common.h,
c-convert.c, c-decl.c, c-dump.c, c-dump.h, c-errors.c,
c-format.c, c-lang.c, c-lex.c, c-lex.h, c-parse.in,
c-pragma.c, c-pragma.h, c-semantics.c, c-tree.h, c-typeck.c,
caller-save.c, calls.c, collect2.c, collect2.h, combine.c,
conditions.h, config.gcc, configure.frag, configure.in,
conflict.c, convert.c, convert.h, cppspec.c, crtstuff.c,
cse.c, cselib.c, cselib.h, dbxout.c, dbxout.h, defaults.h,
dependence.c, df.c, df.h, diagnostic.c, diagnostic.h,
doloop.c, dominance.c, dwarf.h, dwarf2.h, dwarf2asm.c,
dwarf2asm.h, dwarf2out.c, dwarf2out.h, dwarfout.c,
emit-rtl.c, errors.c, errors.h, except.c, except.h,
exgettext, explow.c, expmed.c, expr.c, expr.h, final.c,
fixproto, flags.h, flow.c, fold-const.c, fp-test.c,
function.c, function.h, gbl-ctors.h, gcc.c, gcc.h, gcc.hlp,
gccspec.c, gcov-io.h, gcse.c, genattr.c, genattrtab.c,
gencheck.c, gencodes.c, genconfig.c, genemit.c,
genextract.c, genflags.c, gengenrtl.c, genmultilib,
genopinit.c, genoutput.c, genpeep.c, genrecog.c,
gensupport.c, gensupport.h, ggc-callbacks.c, ggc-common.c,
ggc-none.c, ggc-page.c, ggc-simple.c, ggc.h, global.c,
graph.c, graph.h, gthr-aix.h, gthr-dce.h, gthr-posix.h,
gthr-rtems.h, gthr-single.h, gthr-solaris.h, gthr-vxworks.h,
gthr-win32.h, gthr.h, haifa-sched.c, halfpic.c, halfpic.h,
hard-reg-set.h, hwint.h, ifcvt.c, input.h, insn-addr.h,
integrate.c, integrate.h, jump.c, lcm.c, libgcc2.c,
libgcc2.h, lists.c, local-alloc.c, loop.c, loop.h,
machmode.def, machmode.h, main.c, mbchar.c, mbchar.h,
mips-tdump.c, mips-tfile.c, mklibgcc.in, mkmap-flat.awk,
mkmap-symver.awk, optabs.c, output.h, params.c, params.def,
params.h, predict.c, predict.def, predict.h, prefix.c,
prefix.h, print-rtl.c, print-tree.c, profile.c, protoize.c,
read-rtl.c, real.c, real.h, recog.c, recog.h, reg-stack.c,
regclass.c, regmove.c, regrename.c, regs.h, reload.c,
reload.h, reload1.c, reorg.c, resource.c, resource.h, rtl.c,
rtl.def, rtl.h, rtlanal.c, sbitmap.c, sbitmap.h,
sched-deps.c, sched-ebb.c, sched-int.h, sched-rgn.c,
sched-vis.c, sdbout.c, sdbout.h, sibcall.c, simplify-rtx.c,
ssa-ccp.c, ssa-dce.c, ssa.c, ssa.h, stmt.c, stor-layout.c,
stringpool.c, system.h, timevar.c, timevar.def, timevar.h,
tlink.c, toplev.c, toplev.h, tree.c, tree.def, tree.h,
tsystem.h, unroll.c, unwind-dw2-fde.c, unwind-dw2-fde.h,
unwind-dw2.c, unwind-pe.h, unwind-sjlj.c, unwind.h,
unwind.inc, varasm.c, varray.c, varray.h, xcoffout.c,
xcoffout.h: replace "GNU CC" with "GCC".
From-SVN: r45105
2001-08-22 22:35:51 +08:00
|
|
|
GCC is distributed in the hope that it will be useful, but WITHOUT ANY
|
|
|
|
WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
|
|
|
for more details.
|
1997-12-25 07:56:08 +08:00
|
|
|
|
2009-04-09 23:00:19 +08:00
|
|
|
Under Section 7 of GPL version 3, you are granted additional
|
|
|
|
permissions described in the GCC Runtime Library Exception, version
|
|
|
|
3.1, as published by the Free Software Foundation.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License and
|
|
|
|
a copy of the GCC Runtime Library Exception along with this program;
|
|
|
|
see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
|
|
|
|
<http://www.gnu.org/licenses/>. */
|
1997-12-25 07:56:08 +08:00
|
|
|
|
2001-05-26 09:31:47 +08:00
|
|
|
#ifndef GCC_GTHR_H
|
|
|
|
#define GCC_GTHR_H
|
1997-12-25 07:56:08 +08:00
|
|
|
|
2004-11-30 16:15:42 +08:00
|
|
|
#ifndef HIDE_EXPORTS
|
2004-08-04 00:57:40 +08:00
|
|
|
#pragma GCC visibility push(default)
|
2004-11-30 16:15:42 +08:00
|
|
|
#endif
|
2004-08-04 00:57:40 +08:00
|
|
|
|
1997-12-25 07:56:08 +08:00
|
|
|
/* If this file is compiled with threads support, it must
|
|
|
|
#define __GTHREADS 1
|
|
|
|
to indicate that threads support is present. Also it has define
|
2002-06-04 19:30:46 +08:00
|
|
|
function
|
1997-12-25 07:56:08 +08:00
|
|
|
int __gthread_active_p ()
|
|
|
|
that returns 1 if thread system is active, 0 if not.
|
|
|
|
|
|
|
|
The threads interface must define the following types:
|
|
|
|
__gthread_key_t
|
|
|
|
__gthread_once_t
|
|
|
|
__gthread_mutex_t
|
2004-08-28 10:33:54 +08:00
|
|
|
__gthread_recursive_mutex_t
|
1997-12-25 07:56:08 +08:00
|
|
|
|
|
|
|
The threads interface must define the following macros:
|
|
|
|
|
|
|
|
__GTHREAD_ONCE_INIT
|
|
|
|
to initialize __gthread_once_t
|
|
|
|
__GTHREAD_MUTEX_INIT
|
|
|
|
to initialize __gthread_mutex_t to get a fast
|
|
|
|
non-recursive mutex.
|
1998-08-27 22:51:55 +08:00
|
|
|
__GTHREAD_MUTEX_INIT_FUNCTION
|
2012-03-12 22:23:27 +08:00
|
|
|
to initialize __gthread_mutex_t to get a fast
|
|
|
|
non-recursive mutex.
|
|
|
|
Define this to a function which looks like this:
|
1998-08-27 22:51:55 +08:00
|
|
|
void __GTHREAD_MUTEX_INIT_FUNCTION (__gthread_mutex_t *)
|
2012-03-12 22:23:27 +08:00
|
|
|
Some systems can't initialize a mutex without a
|
|
|
|
function call. Don't define __GTHREAD_MUTEX_INIT in this case.
|
2004-08-28 10:33:54 +08:00
|
|
|
__GTHREAD_RECURSIVE_MUTEX_INIT
|
|
|
|
__GTHREAD_RECURSIVE_MUTEX_INIT_FUNCTION
|
|
|
|
as above, but for a recursive mutex.
|
1997-12-25 07:56:08 +08:00
|
|
|
|
|
|
|
The threads interface must define the following static functions:
|
|
|
|
|
|
|
|
int __gthread_once (__gthread_once_t *once, void (*func) ())
|
|
|
|
|
|
|
|
int __gthread_key_create (__gthread_key_t *keyp, void (*dtor) (void *))
|
|
|
|
int __gthread_key_delete (__gthread_key_t key)
|
|
|
|
|
|
|
|
void *__gthread_getspecific (__gthread_key_t key)
|
|
|
|
int __gthread_setspecific (__gthread_key_t key, const void *ptr)
|
|
|
|
|
2008-03-01 18:46:31 +08:00
|
|
|
int __gthread_mutex_destroy (__gthread_mutex_t *mutex);
|
2012-10-03 04:22:32 +08:00
|
|
|
int __gthread_recursive_mutex_destroy (__gthread_recursive_mutex_t *mutex);
|
2008-03-01 18:46:31 +08:00
|
|
|
|
1997-12-25 07:56:08 +08:00
|
|
|
int __gthread_mutex_lock (__gthread_mutex_t *mutex);
|
|
|
|
int __gthread_mutex_trylock (__gthread_mutex_t *mutex);
|
|
|
|
int __gthread_mutex_unlock (__gthread_mutex_t *mutex);
|
|
|
|
|
2004-08-28 10:33:54 +08:00
|
|
|
int __gthread_recursive_mutex_lock (__gthread_recursive_mutex_t *mutex);
|
|
|
|
int __gthread_recursive_mutex_trylock (__gthread_recursive_mutex_t *mutex);
|
|
|
|
int __gthread_recursive_mutex_unlock (__gthread_recursive_mutex_t *mutex);
|
gthr-posix.h (__gthread_cond_broadcast, [...]): Add to extend interface for POSIX conditional variables.
2007-09-13 Doug Kwan <dougkwan@google.com>
* gcc/gthr-posix.h (__gthread_cond_broadcast, __gthread_cond_wait,
__gthread_cond_wait_recursive): Add to extend interface for POSIX
conditional variables. (__GTHREAD_HAS_COND): Macro defined to signify
support of conditional variables.
* gcc/gthr-posix95.h (__gthread_cond_broadcast, __gthread_cond_wait,
__gthread_cond_wait_recursive): Add to extend interface for POSIX
conditional variables. (__GTHREAD_HAS_COND): Macro defined to signify
support of conditional variables.
* gcc/gthr-single.h (__gthread_cond_broadcast, __gthread_cond_wait,
__gthread_cond_wait_recursive): Add to extend interface for POSIX
conditional variables.
* gcc/gthr.h: Update comments to document new interface.
* libstdc++-v3/include/ext/concurrent.h (class __mutex,
class __recursive_mutex): Add new method gthread_mutex to access
inner gthread mutex.
[__GTHREAD_HAS_COND] (class __concurrence_broadcast_error,
class __concurrence_wait_error, class __cond): Add.
* guard.cc (recursive_push, recursive_pop): Delete.
(init_in_progress_flag, set_init_in_progress_flag): Add to
replace recursive_push and recursive_pop.
(throw_recursive_init_exception): Add.
(acquire, __cxa_guard_acquire, __cxa_guard_abort and
__cxa_guard_release): [__GTHREAD_HAS_COND] Use a conditional
for synchronization of static variable initialization.
The global mutex is only held briefly when guards are
accessed. [!__GTHREAD_HAS_COND] Fall back to the old code,
which deadlocks.
* testsuite/thread/guard.cc: Add new test. It deadlocks with the
old locking code in libstdc++-v3/libsup++/guard.cc.
From-SVN: r129030
2007-10-05 13:35:46 +08:00
|
|
|
|
|
|
|
The following are supported in POSIX threads only. They are required to
|
|
|
|
fix a deadlock in static initialization inside libsupc++. The header file
|
|
|
|
gthr-posix.h defines a symbol __GTHREAD_HAS_COND to signify that these extra
|
|
|
|
features are supported.
|
|
|
|
|
|
|
|
Types:
|
|
|
|
__gthread_cond_t
|
|
|
|
|
|
|
|
Macros:
|
|
|
|
__GTHREAD_COND_INIT
|
|
|
|
__GTHREAD_COND_INIT_FUNCTION
|
|
|
|
|
|
|
|
Interface:
|
|
|
|
int __gthread_cond_broadcast (__gthread_cond_t *cond);
|
|
|
|
int __gthread_cond_wait (__gthread_cond_t *cond, __gthread_mutex_t *mutex);
|
|
|
|
int __gthread_cond_wait_recursive (__gthread_cond_t *cond,
|
|
|
|
__gthread_recursive_mutex_t *mutex);
|
2004-08-28 10:33:54 +08:00
|
|
|
|
1998-03-11 20:07:25 +08:00
|
|
|
All functions returning int should return zero on success or the error
|
|
|
|
number. If the operation is not supported, -1 is returned.
|
1997-12-25 07:56:08 +08:00
|
|
|
|
2009-11-25 18:55:54 +08:00
|
|
|
If the following are also defined, you should
|
2008-08-28 17:20:57 +08:00
|
|
|
#define __GTHREADS_CXX0X 1
|
2009-11-25 18:55:54 +08:00
|
|
|
to enable the c++0x thread library.
|
|
|
|
|
2008-08-28 17:20:57 +08:00
|
|
|
Types:
|
|
|
|
__gthread_t
|
|
|
|
__gthread_time_t
|
|
|
|
|
|
|
|
Interface:
|
2009-11-25 18:55:54 +08:00
|
|
|
int __gthread_create (__gthread_t *thread, void *(*func) (void*),
|
2008-08-28 17:20:57 +08:00
|
|
|
void *args);
|
|
|
|
int __gthread_join (__gthread_t thread, void **value_ptr);
|
|
|
|
int __gthread_detach (__gthread_t thread);
|
|
|
|
int __gthread_equal (__gthread_t t1, __gthread_t t2);
|
|
|
|
__gthread_t __gthread_self (void);
|
|
|
|
int __gthread_yield (void);
|
|
|
|
|
|
|
|
int __gthread_mutex_timedlock (__gthread_mutex_t *m,
|
|
|
|
const __gthread_time_t *abs_timeout);
|
|
|
|
int __gthread_recursive_mutex_timedlock (__gthread_recursive_mutex_t *m,
|
|
|
|
const __gthread_time_t *abs_time);
|
2009-11-25 18:55:54 +08:00
|
|
|
|
2008-08-28 17:20:57 +08:00
|
|
|
int __gthread_cond_signal (__gthread_cond_t *cond);
|
2009-11-25 18:55:54 +08:00
|
|
|
int __gthread_cond_timedwait (__gthread_cond_t *cond,
|
2008-08-28 17:20:57 +08:00
|
|
|
__gthread_mutex_t *mutex,
|
|
|
|
const __gthread_time_t *abs_timeout);
|
|
|
|
|
1997-12-25 07:56:08 +08:00
|
|
|
*/
|
|
|
|
|
1998-04-03 07:15:06 +08:00
|
|
|
#if SUPPORTS_WEAK
|
2012-02-21 05:22:07 +08:00
|
|
|
/* The pe-coff weak support isn't fully compatible to ELF's weak.
|
|
|
|
For static libraries it might would work, but as we need to deal
|
|
|
|
with shared versions too, we disable it for mingw-targets. */
|
|
|
|
#ifdef __MINGW32__
|
|
|
|
#undef GTHREAD_USE_WEAK
|
|
|
|
#define GTHREAD_USE_WEAK 0
|
|
|
|
#endif
|
|
|
|
|
1997-12-25 07:56:08 +08:00
|
|
|
#ifndef GTHREAD_USE_WEAK
|
|
|
|
#define GTHREAD_USE_WEAK 1
|
|
|
|
#endif
|
1998-04-03 07:15:06 +08:00
|
|
|
#endif
|
1997-12-25 07:56:08 +08:00
|
|
|
#include "gthr-default.h"
|
|
|
|
|
2004-11-30 16:15:42 +08:00
|
|
|
#ifndef HIDE_EXPORTS
|
2004-08-11 10:50:14 +08:00
|
|
|
#pragma GCC visibility pop
|
2004-11-30 16:15:42 +08:00
|
|
|
#endif
|
2004-08-04 00:57:40 +08:00
|
|
|
|
2001-05-26 09:31:47 +08:00
|
|
|
#endif /* ! GCC_GTHR_H */
|