Commit Graph

46 Commits

Author SHA1 Message Date
Philip Withnall
5942cd7984 gio: Add SPDX license headers automatically
Add SPDX license (but not copyright) headers to all files which follow a
certain pattern in their existing non-machine-readable header comment.

This commit was entirely generated using the command:
```
git ls-files gio/*.[ch] | xargs perl -0777 -pi -e 's/\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/\n \*\n \* SPDX-License-Identifier: LGPL-2.1-or-later\n \*\n \* This library is free software; you can redistribute it and\/or\n \* modify it under the terms of the GNU Lesser General Public/igs'
```

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>

Helps: #1415
2022-05-18 09:18:52 +01:00
Philip Withnall
8e963e0e31 Port internal uses to use g_source_set_static_name()
This should reduce allocations.

Signed-off-by: Philip Withnall <pwithnall@endlessos.org>
2021-07-26 11:01:07 +01:00
Sébastien Wilmet
3bf4a720c3 gio/: LGPLv2+ -> LGPLv2.1+
Sub-directories inside gio/ already processed in a previous commit:
- fam/
- gdbus-2.0/ (which contains only codegen/)
- gvdb/
- inotify/
- tests/
- win32/
- xdgmime/

Other sub-directories inside gio/:
- completion/: no license headers
- kqueue/: not LGPL, BSD-style license

https://bugzilla.gnome.org/show_bug.cgi?id=776504
2017-05-29 19:53:34 +02:00
Christian Hergert
18a33f72db introspection: use (nullable) or (optional) instead of (allow-none)
If we have an input parameter (or return value) we need to use (nullable).
However, if it is an (inout) or (out) parameter, (optional) is sufficient.

It looks like (nullable) could be used for everything according to the
Annotation documentation, but (optional) is more specific.
2016-11-22 14:14:37 -08:00
Philip Withnall
3613b7a366 gio: Add source tags to various GTasks constructed in GLib
This makes them easier to identify when debugging and profiling.

This patch was somewhat less than interesting to write.

https://bugzilla.gnome.org/show_bug.cgi?id=767765
2016-06-29 15:16:52 +01:00
Bastien Nocera
8792609e15 gio: Add names to idles and timeouts
This isn't too useful for some of the "return result in idle"
functions, but it's better than nothing.

https://bugzilla.gnome.org/show_bug.cgi?id=726872
2014-03-27 12:53:00 +01:00
Matthias Clasen
e7fd3de86d Eradicate links and xrefs
These are all replaced by markdown ref links.
2014-02-08 12:26:56 -05:00
Matthias Clasen
c575d24dfb Docs: Don't use the note tag
More markup avoidance.
2014-01-31 18:20:06 -05:00
Daniel Mustieles
078dbda148 Updated FSF's address 2014-01-31 14:31:55 +01:00
Dan Winship
55e7ca6e1b gio: deprecate gioscheduler, soft deprecate GSimpleAsyncResult
Reimplement gioscheduler in terms of GTask, and deprecate the original
gioscheduler methods. Update docs to point people to GTask rather than
gioscheduler and GSimpleAsyncResult, but don't actually formally
deprecate GSimpleAsyncResult yet.

https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-10-10 10:29:36 -04:00
Dan Winship
b3f9637337 gthreadpool: set default max_unused_threads and max_idle_time values
GThreadPool defaulted to 0 for max_unused_threads (meaning thread-pool
threads would exit immediately if there was not already another task
waiting for them), and 0 for max_idle_time (meaning unused threads
would linger forever, though this is only relevant if you changed
max_unused_threads).

However, GIOScheduler changed the global defaults to 2 and 15*1000,
respectively, arguing that these were more useful defaults. And they
are, so let's use them.

https://bugzilla.gnome.org/show_bug.cgi?id=661767
2012-07-31 14:37:56 -04:00
Stef Walter
a0b71839ee GIOScheduler: Fix access after free in "cancelled" handler
* GCancellable can be "cancelled" more than once if
   g_cancellable_reset() is called.
 * Don't assume that because the "cancelled" signal fired
   it won't fire again.

https://bugzilla.gnome.org/show_bug.cgi?id=680111
2012-07-17 13:47:26 -04:00
Colin Walters
b65194e8df GIOScheduler: Disconnect from cancellable after job completes
This was causing crashes when a cancellable was canceled after the job
had completed.

https://bugzilla.gnome.org/show_bug.cgi?id=678576
2012-06-25 17:07:16 -04:00
Ryan Lortie
115ca3d897 Revert "GIOScheduler: Avoid constant iteration over pending job list"
This reverts commit 2839297686.

Conflicts:

	gio/gioscheduler.c

https://bugzilla.gnome.org/show_bug.cgi?id=678576
2012-06-25 16:19:03 -04:00
Colin Walters
991d07d66a GIOScheduler: Use a GList, not GSList for jobs
In general, code using g_slist_delete_link() is broken, because it
potentially requires an O(n) traversal.  Just switch to GList in this
case.

The performance hit here was exacerbated by the fact that we were
holding a mutex that needed to be accessed by all threads.

https://bugzilla.gnome.org/show_bug.cgi?id=678576
2012-06-22 11:46:06 -04:00
Colin Walters
2839297686 GIOScheduler: Avoid constant iteration over pending job list
The iteration over the list (while holding a mutex) was a serious
performance hit for asynchronous I/O.  We can just use
g_cancellable_connect().

https://bugzilla.gnome.org/show_bug.cgi?id=678576
2012-06-22 11:46:06 -04:00
Robert Ancell
4143842eb4 Add missing allow-none annotations for function parameters.
Found using:
find . -name '*.c' | xargs grep 'or %NULL' | grep ' \* @' | grep -v '@error' | grep -v allow-none
2012-03-31 20:34:28 +11:00
Dan Winship
59f1f54655 Add g_main_context_ref_thread_default()
Add g_main_context_ref_thread_default(), which always returns a
reffed GMainContext, rather than sometimes returning a (non-reffed)
GMainContext, and sometimes returning NULL. This simplifies the
bookkeeping in any code that needs to keep a reference to the
thread-default context for a while.

https://bugzilla.gnome.org/show_bug.cgi?id=660994
2011-10-07 10:14:34 -04:00
Dan Winship
7ca83c6c9f Fix up some doc comments that referred to threads not being enabled
(and a few other unrelated comment fixes)
2011-10-05 11:54:36 -04:00
Ryan Lortie
449a1e8bfd Fix an invalid non-looping use of GCond
The GIOScheduler was using a GCond in a way that didn't deal with the
possibility of spurious wakeups.  Add an explicit predicate and a loop.

Problem caught by Matthias Clasen.

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:57:35 -04:00
Ryan Lortie
c474cd71ba GIO: switch a couple more GMutex users to _init()
Move a couple more GIO users off of _new()/_free() to _init()/_clear().

https://bugzilla.gnome.org/show_bug.cgi?id=660739
2011-10-04 11:57:34 -04:00
Dan Winship
5a30712dc7 Remove !g_thread_supported() codepaths in gio
In particular, remove the libasyncns import, which was only used by
GUnixResolver, which is only used when threads are not available.
Likewise remove GWin32Resolver, and the hacky broken non-threaded
parts of GIOScheduler.

https://bugzilla.gnome.org/show_bug.cgi?id=616754
2011-09-09 12:47:39 -04:00
Ryan Lortie
aa586f6354 Revert "GIOSchedulerJob: Improve struct packing"
This reverts commit a2094d5e56.

https://bugzilla.gnome.org/show_bug.cgi?id=616754
2011-09-09 12:41:56 -04:00
Matthias Clasen
a2094d5e56 GIOSchedulerJob: Improve struct packing 2011-04-12 10:02:12 -04:00
Ryan Lortie
5b946e0504 gio/: fully remove gioalias hacks 2010-07-07 19:53:22 -04:00
Dan Winship
65cc5d895a Support g_main_context_push_thread_default() in gio
GFile allows for the possibility that external implementations may not
support thread-default contexts yet, via
g_file_supports_thread_contexts(). GVolumeMonitor is not yet
thread-default-context aware.

Add a test program to verify that basic gio async ops work correctly
in non-default contexts.

http://bugzilla.gnome.org/show_bug.cgi?id=579984
2009-07-01 09:02:46 -04:00
Alexander Larsson
8cb481fd5f Use io_prio as mainloop prio for async-emulation (#579449)
I'm not sure why we used the elaborate formula to convert the io-priority
to the priority of the mainloop idle when emulating async i/o with idles.
However, it causes the default io priority to be less than the normal
idle prio, so the i/o won't be scheduled if there is an idle outstanding.

There is really no great mapping to use here, doing blocking i/o in an
idle of any prio is generally bad and apps doing a lot of async i/o should
initialize threads. However, if we use the io-priority directly we at least
avoid the starvation problem above and make things easier to understand.
2009-06-18 19:43:46 +02:00
Matthias Clasen
f548330275 Fix "it's" vs "its" confusion throughout the source. Patch by Will
* Fix "it's" vs "its" confusion throughout the source. Patch
        by Will Thompson.


svn path=/trunk/; revision=7897
2009-02-23 04:30:06 +00:00
Cody Russell
3d93bf6968 Moved all relevant typedefs into these files.
2008-07-01  Cody Russell  <bratsche@gnome.org>

        * gio/gioenums.h:
        * gio/giotypes.h:
	Moved all relevant typedefs into these	files.

        * gio/*.[ch]:
	Updated wrt added files.

        Split types into separate file	for easier maintainership. (#538564)


svn path=/trunk/; revision=7127
2008-07-01 06:32:35 +00:00
Johan Dahlin
761424465a Include "config.h" instead of <config.h> Command used: find -name
2008-06-21  Johan Dahlin  <jdahlin@async.com.br>

    * *.[ch]: Include "config.h" instead of <config.h>
    Command used:
    find -name \*.[ch]|xargs perl -p -i -e 's/^#include <config.h>/#include "config.h"/g'
    Rubberstamped by Mitch


svn path=/trunk/; revision=7092
2008-06-22 15:10:51 +00:00
Matthias Clasen
f3144c7efe Doc fixes
svn path=/trunk/; revision=6554
2008-02-21 18:20:17 +00:00
Matthias Clasen
8228f7f94b Make GIOSchedulerJobFunc return boolean Keep calling io jobs until they
2008-01-25  Matthias Clasen  <mclasen@redhat.com>

        * gioscheduler.h: Make GIOSchedulerJobFunc return boolean
        * gioscheduler.c: Keep calling io jobs until they return FALSE;
        this allows big jobs to be executed in chunks, instead of blocking
        the main loop for a long time.

        * gsimpleasyncresult.c:
        * giofile.c: Adapt callers.

svn path=/trunk/; revision=6375
2008-01-25 14:40:54 +00:00
Matthias Clasen
3bb0a17bd5 Some doc additions
svn path=/trunk/; revision=6358
2008-01-23 05:46:43 +00:00
Matthias Clasen
0debd52858 Fix up includes in section docs
svn path=/trunk/; revision=6149
2007-12-18 02:52:11 +00:00
Matthias Clasen
2e3f48993d Documentation updates
svn path=/trunk/; revision=6138
2007-12-17 07:04:51 +00:00
Alexander Larsson
3db93c01b7 Rename gioscheduler calls so they all use the g_io_schedule_ prefix. Split
2007-12-14  Alexander Larsson  <alexl@redhat.com>

        * gioscheduler.[ch]:
        * gsimpleasyncresult.c:
	Rename gioscheduler calls so they all use the g_io_schedule_ prefix.
	Split out the send_to_mainloop call into two versions instead
	of having the block argument.


svn path=/trunk/; revision=6116
2007-12-14 09:42:59 +00:00
Alexander Larsson
2ae689e31f g_push/pop_current_cancellable -> g_cancellable_push/pop_current
2007-12-13  Alexander Larsson  <alexl@redhat.com>

        * gcancellable.[ch]:
        * gio.symbols:
        * gbufferedinputstream.c:
        * gfileenumerator.c:
        * gfileinputstream.c:
        * gfileoutputstream.c:
        * ginputstream.c:
        * gioscheduler.c:
        * goutputstream.c:
	g_push/pop_current_cancellable ->
	g_cancellable_push/pop_current


svn path=/trunk/; revision=6115
2007-12-13 16:48:06 +00:00
Alexander Larsson
afc16811d8 Fix race condition when freeing proxy in g_io_job_send_to_mainloop().
2007-12-12  Alexander Larsson  <alexl@redhat.com>

        * gioscheduler.c:
	Fix race condition when freeing proxy in
	g_io_job_send_to_mainloop().



svn path=/trunk/; revision=6105
2007-12-12 19:34:19 +00:00
Alexander Larsson
41d1650c9b Fix up a bunch of details in the docs.
2007-12-12  Alexander Larsson  <alexl@redhat.com>

        * gappinfo.[ch]:
        * gasyncresult.c:
        * gbufferedinputstream.c:
        * gbufferedoutputstream.c:
        * gcancellable.c:
        * gcontenttype.c:
        * gdatainputstream.[ch]:
        * gdesktopappinfo.c:
        * gdirectorymonitor.c:
        * gfile.[ch]:
        * gfileattribute.[ch]:
        * gfileicon.[ch]:
        * gfileinfo.h:
        * gfileinputstream.h:
        * gfilemonitor.[ch]:
        * gfileoutputstream.[ch]:
        * gfilterinputstream.h:
        * gfilteroutputstream.h:
        * gicon.h:
        * gioscheduler.c:
        * gloadableicon.[ch]:
        * gmemoryinputstream.c:
        * gmountoperation.c:
        * gthemedicon.c:
	Fix up a bunch of details in the docs.

        * glocalfileinfo.c:
	CR/LF -> LF fixups


svn path=/trunk/; revision=6100
2007-12-12 12:19:02 +00:00
A. Walton
ab69ee2945 More documentation cleanup and filling in missing information, bringing
2007-12-09  A. Walton  <awalton@svn.gnome.org>

	* gdesktopappinfo.c:
	* gdrive.c:
	* gdrive.h:
	* gfile.c:
	* gfile.h:
	* gfileattribute.c:
	* gfileenumerator.c:
	* gioerror.c:
	* gioscheduler.c:
	* gioscheduler.h:
	* gloadableicon.c:
	* gmemoryinputstream.c:
	* gmemoryoutputstream.c:
	* goutputstream.h:
	* gsimpleasyncresult.c:
	More documentation cleanup and filling in missing information, 
bringing
	GIO to 99% symbol coverage.

svn path=/trunk/; revision=6077
2007-12-09 15:51:12 +00:00
Matthias Clasen
c524cabff2 Add docs for etags
svn path=/trunk/; revision=6001
2007-11-30 18:11:03 +00:00
Matthias Clasen
3d8579f93a Explain I/O priorieties
svn path=/trunk/; revision=6000
2007-11-30 05:51:10 +00:00
Matthias Clasen
09471fec46 Coding style fixups
svn path=/trunk/; revision=5993
2007-11-29 07:17:59 +00:00
Alexander Larsson
7f3280230b Added. Added. Added. Added.
2007-11-28  Alexander Larsson  <alexl@redhat.com>

        * Makefile.am:
        * abicheck.sh: Added.
        * makegioalias.pl: Added.
        * pltcheck.sh: Added.
        * gio.symbols: Added.
	* *.c:
        * inotify/*.c
	Initial work on adding symbol handling.

	* gvfs.h:
	Correct ifdef guard name

        * fam/Makefile.am:
        * inotify/Makefile.am:
        * xdgmime/Makefile.am:
	Include toplevel Makefile.decl


svn path=/trunk/; revision=5972
2007-11-28 12:39:07 +00:00
Andrew Walton
5247f12f36 Bumps documentation to 93% symbol coverage, touching most
of the public files. Fixes broken function documentation prototypes. 
	Fixes GCancellable inaccuracies. Removes unnecessary incomplete 
	gtk-doc headers in private files.

svn path=/trunk/; revision=5953
2007-11-27 14:00:13 +00:00
Alexander Larsson
3781343738 gio/ docs/reference/gio Merged gio-standalone into glib.
2007-11-26  Alexander Larsson  <alexl@redhat.com>

        * Makefile.am:
        * configure.in:
        * gio-2.0-uninstalled.pc.in:
        * gio-2.0.pc.in: 
        * gio-unix-2.0-uninstalled.pc.in:
        * gio-unix-2.0.pc.in:
	* gio/
	* docs/reference/gio
	Merged gio-standalone into glib.
	
        * glib/glibintl.h:
        * glib/gutils.c:
	Export glib_gettext so that gio can use it
	Add P_ (using same domain for now)
	Add I_ as g_intern_static_string


svn path=/trunk/; revision=5941
2007-11-26 16:13:05 +00:00