Commit Graph

10798 Commits

Author SHA1 Message Date
Matthias Clasen
81b3708184 Add a mutex test
This tests that mutexes do what they are supposed to do.
Copied from a similar test for bitlocks in gthread/tests/bitlock.c.
2011-09-23 06:31:59 -04:00
Yaron Shahrabani
bcd02d7a75 Updated Hebrew translation 2011-09-23 08:23:25 +03:00
Matthias Clasen
4f3026ea23 Add headers 2011-09-22 22:45:47 -04:00
Matthias Clasen
d4d203e3cb Fix g_rwlock_{writer,reader}_trylock 2011-09-22 22:45:47 -04:00
Matthias Clasen
ff13913537 Add basic tests for GRWLock
Just basic api usage, no functional test cases yet.
2011-09-22 22:45:47 -04:00
Chun-wei Fan
b2717740a2 VS support updates
-Fix GLib project/filter files generation as some source items are under
 the "deprecated" subfolder, and filter out the gthread-*.c
-Explicitly specify gthread-win32.c in the GLib project/filter file
 templates, since tarballs are done on Linux.
-Don't define g_static_mutex_get_mutex in the pregenerated
 glibconfig.h.win32(.in) as it is defined in deprecated/gthread.h for Windows
2011-09-23 10:48:25 +08:00
Matthias Clasen
9de564bf1f Fix g_rec_mutex_trylock 2011-09-22 21:58:55 -04:00
Matthias Clasen
295af777e4 Add trivial tests for GMutex and GRecMutex
Not testing any mutual exclusion with threads yet, just
basic api use. This is already enough to reveal g_rec_mutex_trylock
as broken...
2011-09-22 21:58:54 -04:00
Chun-wei Fan
9958909fb2 gmappedfile.c: Define S_IFREG on Win32 when it's not available
Make a workaround for S_IFREG in gmappedfile.c on Windows as it may not be
available for a given compiler on that platform
2011-09-23 09:36:37 +08:00
Colin Walters
f42fe6cdc0 gvalue: Add explicitly signed g_value_get_schar() and g_value_set_schar()
The documentation for G_TYPE_CHAR says:

"The type designated by G_TYPE_CHAR is unconditionally an 8-bit signed
 integer."

However the return value for g_value_get_char() was just "char" which
in C has an unspecified signedness; on e.g. x86 it's signed (which
matches the GType), but on e.g. PowerPC or ARM, it's not.

We can't break the old API, so we need to suck it up and add new API.
Port most internal users, but keep some tests of the old API too.

https://bugzilla.gnome.org/show_bug.cgi?id=659870
2011-09-22 20:05:38 -04:00
Colin Walters
1df8160fa6 tests: Add a some torture test cases for the generic marshaller
In particular this has a test case for a G_TYPE_ENUM which we were
running into a failure on ppc64.

https://bugzilla.gnome.org/show_bug.cgi?id=659881
2011-09-22 18:51:43 -04:00
Ryan Lortie
c59846086b Add gthread.h to deprecated headers
...not deprecated sources
2011-09-22 13:48:00 -04:00
Emmanuele Bassi
8e716cbb49 Fix annotations for source/target in g_object_bind_property_*
We use gpointer for convience of the C API users, but introspection
users will not like it.

https://bugzilla.gnome.org/show_bug.cgi?id=659838
2011-09-22 17:17:54 +01:00
Manoj Kumar Giri
35829d28b9 Updated Oriya Translation 2011-09-22 19:46:01 +05:30
Matthias Clasen
558955dd85 Some gthread doc updates
Marking things as deprecated, mostly.
2011-09-22 01:16:41 -04:00
Matthias Clasen
cedc82290f Use adaptive mutexes when available
These are supposedly better on multi-cpu systems - and who doesn't
have multiple cpus nowadays. One single-processor systems, they
are identical to normal mutexes.
See e.g. http://bugzilla.mozilla.org/show_bug.cgi?id=132089

https://bugzilla.gnome.org/show_bug.cgi?id=659423
2011-09-22 00:54:34 -04:00
Ryan Lortie
19e7026fe7 GDateTime test: fix a race
We have a GDateTime test that compares the time now (as per the libc) to
the time now (as per GDateTime).  The problem is that the time could
change between those two "now"s.
2011-09-21 20:23:03 -04:00
Ryan Lortie
af9e40dc5d gslice: remove single-threaded case
GPrivate always works, so use it normally at all times.
2011-09-21 20:23:02 -04:00
Philip Van Hoof
ca154c399b GMappedFile: Add API to create from an existing file descriptor
At Tracker we want to mmap files using O_NOATIME. With GMappedFile this is at
the moment impossible. For that reason I added the constructor new_from_fd to
the GMappedFile type.

https://bugzilla.gnome.org/show_bug.cgi?id=659754
2011-09-22 00:01:56 +02:00
Ryan Lortie
24652730a9 Deprecate GStatic{,Rec,RW}Mutex
The new versions use the primatives of the OS directly and don't have an
annoying ABI.
2011-09-21 16:09:05 -04:00
Ryan Lortie
aecec33c49 gtype: port from GStaticRWLock to GRWLock 2011-09-21 16:09:05 -04:00
Ryan Lortie
b6140c2f89 Port internal GStaticRecMutex users to GRecMutex 2011-09-21 16:09:04 -04:00
Ryan Lortie
ad187e3a9b Add a new recursive mutex type, GRecMutex
This is implemented using the native facilities of each platform instead
of manually.
2011-09-21 16:09:04 -04:00
Ryan Lortie
3d4102776e Add GRWLock 2011-09-21 16:09:03 -04:00
Ryan Lortie
42af8eb39d gthread: remove impl init functions 2011-09-21 16:06:56 -04:00
Ryan Lortie
2539bd007d win32: Add 'shared' support to SRWLock emulation 2011-09-21 16:06:56 -04:00
Ryan Lortie
9f42e3be1b gthread-win32: trivial condition change
Make another do-nothing change to the SRWLock emulation.
2011-09-21 16:06:56 -04:00
Ryan Lortie
391aea32f3 gthread-win32: rename a struct member
Our SRWLock is about to become a real reader/writer lock, so rename an
instance variable to prepare for that.
2011-09-21 16:06:56 -04:00
Ryan Lortie
d7aeae97ef gthread.h: remove some bogus decl/comments
These are no longer relevent since the possibility of a thread-disabled
GLib disappeared.
2011-09-21 16:06:56 -04:00
Ryan Lortie
894dd4f62b Revert "Drop an unused variable"
This reverts commit c7f9cd17d446938aaf4126e0753302676f66fd22.

The old macros in gthread.h used this variable, so it must remain in
place to keep ABI compatibility.
2011-09-21 16:06:56 -04:00
Matthias Clasen
8ef30eb3da Drop an unused variable 2011-09-21 16:06:56 -04:00
Matthias Clasen
7d859fb67f More header cosmetics 2011-09-21 16:06:56 -04:00
Matthias Clasen
c291259c65 trivial: small header reordering 2011-09-21 16:06:56 -04:00
Ryan Lortie
ae2ac9e809 Move some things to deprecated/gthread.h 2011-09-21 16:06:56 -04:00
Ryan Lortie
97972fbb3a g_thread_init: take a gpointer as the arg
GThreadFunctions is about to disappear.
2011-09-21 16:06:56 -04:00
Ryan Lortie
abba53e396 disable glib-ctor on win32 2011-09-21 16:06:55 -04:00
Ryan Lortie
14e6377a60 Deprecate g_thread_create_full()
Replace it with g_thread_create_with_stack_size() and a real function
implementation of g_thread_create().

Modify a testcase that was calling g_thread_create_full()
inappropriately (it was using the default values anyway).
2011-09-21 16:06:55 -04:00
Ryan Lortie
9621b1093e Drop g_thread_fail()
This is now unused.
2011-09-21 16:06:55 -04:00
Ryan Lortie
b2c1364ab2 g_system_thread_create: drop unused args
The 'bound' and 'priority' arguments are no longer in use, so drop them.
2011-09-21 16:06:55 -04:00
Ryan Lortie
2b4c303d61 Remove the concept of 'bound'
This was ignored on Windows.  On POSIX, where supported, it controlled
if we ended up with a proper system thread or a user-mode thread.  Linux
did not support this.
2011-09-21 16:06:55 -04:00
Matthias Clasen
cebcfed783 Remove a leftover from errorcheck mutexes 2011-09-21 16:06:55 -04:00
Ryan Lortie
cffed9a03a Remove g_thread_functions_for_glib_use_old
This has been unused for a while and it should definitely go away now
that g_thread_functions_for_glib_use is back in gthread.c.
2011-09-21 16:06:55 -04:00
Ryan Lortie
6972ed340b Merge g_thread_functions_for_glib_use
Move the now-identical copies of g_thread_functions_for_glib_use from
gthread-{posix,win32}.c back into gthread.c.
2011-09-21 16:06:55 -04:00
Ryan Lortie
6ea1721191 gthread.h: drop the vtable access macros
We're finally free of these.  Drop them.
2011-09-21 16:06:55 -04:00
Ryan Lortie
3422dcfd28 NULL g_system_thread_{exit,equal} in the vtable
These were never used from gthread.h and are no longer used from
gthread.c.
2011-09-21 16:06:55 -04:00
Ryan Lortie
7a69d46dc5 GSystemThread: port 'self' 'join' and 'create'
Switch 'self' 'join' and 'create' from using the vtable to being called
via normal g_system_thread_* internal API (implemented in each of
gthread-{posix,win32}.c).

Again, we can put NULL in the vtable since these were never used from
gthread.h.
2011-09-21 16:06:55 -04:00
Ryan Lortie
51d92adeee GThread: deprecate thread priorities
Thread priorities were already documented as not working on Solaris, and
they are meaningless on Linux unless the process separately requests
realtime scheduling (and even then, it appears only to work as root).

We can safely put a NULL into the vtable for set_priority since nothing
outside of gthread.c ever calls this (and that call is gone).
2011-09-21 16:06:54 -04:00
Matthias Clasen
a10306060c Don't use the thread_exit vfunc
Instead, just have the backends implement an internal function
named g_system_thread_exit.
2011-09-21 16:06:54 -04:00
Matthias Clasen
cc7631cd19 Don't use the thread_equal vfunc anymore
Just move the g_system_thread_equal implementation into
the posix and win32 implementations, and drop some micro macro
optimization.
2011-09-21 16:06:54 -04:00
Ryan Lortie
e00bcfcdec gthread-win32: use __stdcall markers where needed
The "unknown reason" that the native thread implementation was broken is
because functions in kernel32.dll are (obviously) following Microsoft's
__stdcall ABI, not the GCC ABI.

Change our function pointers to be __stdcall pointers and change our
emulated implementation to match.
2011-09-21 16:06:54 -04:00