~ubuntu-branches/ubuntu/trusty/ocamlnet/trusty

« back to all changes in this revision

Viewing changes to src/netsys/netsys_signalling.mli

  • Committer: Bazaar Package Importer
  • Author(s): Stéphane Glondu
  • Date: 2011-09-02 14:12:33 UTC
  • mfrom: (18.2.3 sid)
  • Revision ID: james.westby@ubuntu.com-20110902141233-zbj0ygxb92u6gy4z
Tags: 3.4-1
* New upstream release
  - add a new NetcgiRequire directive to ease dependency management
    (Closes: #637147)
  - remove patches that were applied upstream:
    + Added-missing-shebang-lines-in-example-shell-scripts
    + Try-also-ocamlc-for-POSIX-threads

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
(* $Id: netsys_signalling.mli 1160 2007-12-03 00:10:15Z gerd $ *)
 
2
 
 
3
(** Signalling between threads in a poll-compatible way *)
 
4
 
 
5
(** We define here an abstraction that can be both used on Unix and
 
6
    Win32 to signal special conditions between threads. It is
 
7
    a kind of semaphore tied to file descriptors.
 
8
 *)
 
9
 
 
10
class type sigchannel =
 
11
object
 
12
  method file_descr : Unix.file_descr
 
13
    (** A file descriptor that can be used for polling until the signal
 
14
        arrives. One has to poll for reading.
 
15
     *)
 
16
 
 
17
  method receive : unit -> unit
 
18
    (** Receive a signal. If no signal is available, the function will block
 
19
        until a signal arrives. One receives as many signals as have been
 
20
        sent.
 
21
     *)
 
22
 
 
23
  method send : unit -> unit
 
24
    (** Send a signal. Never blocks. *)
 
25
 
 
26
  method dispose : unit -> unit
 
27
    (** Release OS resources associated with this channel. Implicitly
 
28
        closes [file_descr].
 
29
     *)
 
30
 
 
31
end
 
32
 
 
33
 
 
34
val create_sigchannel : unit -> sigchannel
 
35
  (** Creates a new signal channel - for all platforms.
 
36
 
 
37
      Unix: Signalling is implemented using a pipe. By sending a single
 
38
      over the pipe, it is communicated that a positive number of signals
 
39
      is available for receiving. The file desciptor can be used with
 
40
      any form of polling (any Unix pollset will do).
 
41
 
 
42
      Win32: The file descriptor is in reality a Win32 event object.
 
43
      When a positive number of signals is available for receiving,
 
44
      the event object is set. The file descriptor can be used with
 
45
      [Netsys_pollset_win32.sigchannel_pollset].
 
46
 
 
47
      Note that signal channels are also avaiable for single-threaded
 
48
      programs, although they are probably not that useful there.
 
49
   *)