Commit Graph

10835 Commits

Author SHA1 Message Date
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
Ryan Lortie
835c9b75c8 g_private_new: use GSlice
We no longer call g_private_new() from anywhere in GLib, so we can use
gslice instead of malloc().
2011-09-21 16:06:54 -04:00
Matthias Clasen
0ebd842d24 And move the g_thread_yield() docs too 2011-09-21 16:06:54 -04:00
Matthias Clasen
71df026580 Don't use the thread vtable for g_thread_yield() 2011-09-21 16:06:54 -04:00
Matthias Clasen
862e086b79 Move g_private_new() to common code
The implementations for posix and win32 were identical, so
move it to gthread.c, to go with g_mutex_new() and g_cond_new().
2011-09-21 16:06:54 -04:00
Matthias Clasen
dffca80846 Move docs around
Move the docs of functions to the actual functions. Also add
docs for some new apis.
2011-09-21 16:06:54 -04:00
Matthias Clasen
0044763a71 Clean up g_thread_yield implementation
This was the last macro wrapper that was directly accessing the
vtable. Make it a regular function, like the rest.
2011-09-21 16:06:54 -04:00
Ryan Lortie
c4a69e784e gmem: move to glib-ctor 2011-09-21 16:06:54 -04:00
Ryan Lortie
ae4419610c gslice: move initialisation to glib-ctor 2011-09-21 16:06:53 -04:00
Ryan Lortie
8f74c927f6 Add glib-ctor functionality
A pair of macros to define a constructor function (on compilers that
support such a concept) and to ensure that the function is run exactly
once (on compilers that lack such support).

Presently only GCC is implemented.
2011-09-21 16:06:53 -04:00
Ryan Lortie
0e604ef0b5 GThread: always initialise the system thread
It's always safe to call the thread implementation 'self' function.
2011-09-21 16:06:53 -04:00
Ryan Lortie
4596dfbc75 gmessages: do implicit GPrivate initialisation
Initialise the GPrivate implicitly at the site of first use rather than
explicitly from the thread initialisation function.
2011-09-21 16:06:53 -04:00
Ryan Lortie
90679997ec Continue GPrivate rework
We remove the macros while at the same time switching all libglib users
from g_private_new() to g_private_init().  We deal with the strange
expectations of the libglib code that g_private_* should work before the
GPrivate has been initialised with a temporary shim.
2011-09-21 16:06:53 -04:00
Ryan Lortie
b0d83576e2 Rework GPrivate
- expose the structure types for GLib internal use only

 - avoid infinite recursion hazards by ensuring that GPrivate never
   calls back into any other part of GLib

 - substantially rework the Windows implementation so that it never
   holds locks, contains no arbitrary limits and doesn't waste
   100*sizeof(void*) per thread

We have to keep the macro hacks for the time being since some code
inside libglib depends on it.
2011-09-21 16:06:53 -04:00