File: SharedArea.m

package info (click to toggle)
gnustep-examples 1%3A1.2.0-2
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 1,952 kB
  • ctags: 270
  • sloc: objc: 14,381; makefile: 65
file content (69 lines) | stat: -rw-r--r-- 1,479 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
/*
   Copyright (C) 2002 Free Software Foundation, Inc.
   
   Author: Nicola Pero <n.pero@mi.flashnet.it>

   This program is free software; you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation; either version 2 of the License, or
   (at your option) any later version.
   
   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.
   
   You should have received a copy of the GNU General Public License
   along with this program; if not, write to the Free Software
   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 
*/
#include <Foundation/Foundation.h>
#include "SharedArea.h"

static double progress_index = 0;
static BOOL is_running = NO;

static NSLock *lock;

void set_up_shared_area ()
{
  lock = [NSLock new];
}


double progress_indicator ()
{
  double value;

  [lock lock];
  value = progress_index;
  [lock unlock];

  return value;
}

BOOL is_auxiliary_thread_running ()
{
  BOOL value;

  [lock lock];
  value = is_running;
  [lock unlock];

  return value;
}


void set_progress_indicator (double value)
{
  [lock lock];
  progress_index = value;
  [lock unlock];
}

void set_is_auxiliary_thread_running (BOOL flag)
{
  [lock lock];
  is_running = flag;
  [lock unlock];
}