~ubuntu-branches/debian/lenny/fpc/lenny

« back to all changes in this revision

Viewing changes to fpcsrc/packages/extra/gtk2/glib/gasyncqueue.inc

  • Committer: Bazaar Package Importer
  • Author(s): Mazen Neifer, Torsten Werner, Mazen Neifer
  • Date: 2008-05-17 17:12:11 UTC
  • mfrom: (3.1.9 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080517171211-9qi33xhd9evfa0kg
Tags: 2.2.0-dfsg1-9
[ Torsten Werner ]
* Add Mazen Neifer to Uploaders field.

[ Mazen Neifer ]
* Moved FPC sources into a version dependent directory from /usr/share/fpcsrc
  to /usr/share/fpcsrc/${FPCVERSION}. This allow installing more than on FPC
  release.
* Fixed far call issue in compiler preventing building huge binearies.
  (closes: #477743)
* Updated building dependencies, recomennded and suggested packages.
* Moved fppkg to fp-utils as it is just a helper tool and is not required by
  compiler.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
{$ifndef __G_ASYNCQUEUE_H__}
 
2
{$define __G_ASYNCQUEUE_H__}
 
3
 
 
4
// {$include gthread.inc}
 
5
 
 
6
{* Asyncronous Queues, can be used to communicate between threads
 
7
 *}
 
8
 
 
9
    type
 
10
      PGAsyncQueue = pointer;
 
11
{* Get a new GAsyncQueue with the ref_count 1 *}
 
12
 
 
13
    function g_async_queue_new:PGAsyncQueue;cdecl;external gliblib name 'g_async_queue_new';
 
14
 
 
15
{* Lock and unlock an GAsyncQueue, all functions lock the queue for
 
16
 * themselves, but in certain cirumstances you want to hold the lock longer,
 
17
 * thus you lock the queue, call the *_unlocked functions and unlock it again
 
18
 *}
 
19
    procedure g_async_queue_lock(queue:PGAsyncQueue);cdecl;external gliblib name 'g_async_queue_lock';
 
20
    procedure g_async_queue_unlock(queue:PGAsyncQueue);cdecl;external gliblib name 'g_async_queue_unlock';
 
21
 
 
22
 
 
23
{* Ref and unref the GAsyncQueue. g_async_queue_unref_unlocked makes
 
24
 * no sense, as after the unreffing the Queue might be gone and can't
 
25
 * be unlocked. So you have a function to call, if you don't hold the
 
26
 * lock (g_async_queue_unref) and one to call, when you already hold
 
27
 * the lock (g_async_queue_unref_and_unlock). After that however, you
 
28
 * don't hold the lock anymore and the Queue might in fact be
 
29
 * destroyed, if you unrefed to zero *}
 
30
 
 
31
    procedure g_async_queue_ref(queue:PGAsyncQueue);cdecl;external gliblib name 'g_async_queue_ref';
 
32
    procedure g_async_queue_ref_unlocked(queue:PGAsyncQueue);cdecl;external gliblib name 'g_async_queue_ref_unlocked';
 
33
    procedure g_async_queue_unref(queue:PGAsyncQueue);cdecl;external gliblib name 'g_async_queue_unref';
 
34
    procedure g_async_queue_unref_and_unlock(queue:PGAsyncQueue);cdecl;external gliblib name 'g_async_queue_unref_and_unlock';
 
35
 
 
36
{* Push data into the async queue. Must not be NULL *}
 
37
    procedure g_async_queue_push(queue:PGAsyncQueue; data:gpointer);cdecl;external gliblib name 'g_async_queue_push';
 
38
    procedure g_async_queue_push_unlocked(queue:PGAsyncQueue; data:gpointer);cdecl;external gliblib name 'g_async_queue_push_unlocked';
 
39
 
 
40
{* Pop data from the async queue, when no data is there, the thread is blocked
 
41
 * until data arrives *}
 
42
    function g_async_queue_pop(queue:PGAsyncQueue):gpointer;cdecl;external gliblib name 'g_async_queue_pop';
 
43
    function g_async_queue_pop_unlocked(queue:PGAsyncQueue):gpointer;cdecl;external gliblib name 'g_async_queue_pop_unlocked';
 
44
 
 
45
{* Try to pop data, NULL is returned in case of empty queue *}
 
46
    function g_async_queue_try_pop(queue:PGAsyncQueue):gpointer;cdecl;external gliblib name 'g_async_queue_try_pop';
 
47
    function g_async_queue_try_pop_unlocked(queue:PGAsyncQueue):gpointer;cdecl;external gliblib name 'g_async_queue_try_pop_unlocked';
 
48
 
 
49
{* Wait for data until at maximum until end_time is reached, NULL is returned
 
50
 * in case of empty queue*}
 
51
    function g_async_queue_timed_pop(queue:PGAsyncQueue; end_time:PGTimeVal):gpointer;cdecl;external gliblib name 'g_async_queue_timed_pop';
 
52
    function g_async_queue_timed_pop_unlocked(queue:PGAsyncQueue; end_time:PGTimeVal):gpointer;cdecl;external gliblib name 'g_async_queue_timed_pop_unlocked';
 
53
 
 
54
 
 
55
{* Return the length of the queue, negative values mean, that threads
 
56
 * are waiting, positve values mean, that there are entries in the
 
57
 * queue. Actually this function returns the length of the queue minus
 
58
 * the number of waiting threads, g_async_queue_length == 0 could also
 
59
 * mean 'n' entries in the queue and 'n' thread waiting, such can
 
60
 * happen due to locking of the queue or due to scheduling. *}
 
61
 
 
62
    function g_async_queue_length(queue:PGAsyncQueue):gint;cdecl;external gliblib name 'g_async_queue_length';
 
63
    function g_async_queue_length_unlocked(queue:PGAsyncQueue):gint;cdecl;external gliblib name 'g_async_queue_length_unlocked';
 
64
 
 
65
{$endif}
 
66