summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThorsten Behrens <tbehrens@suse.com>2012-12-04 12:36:09 +0100
committerThorsten Behrens <tbehrens@suse.com>2012-12-04 12:38:09 +0100
commitd911673a64250ece50f6ca5578385adabcae5e5d (patch)
tree268d926b6fe13ea891b0a0f61f1bbc178e2f52ae
parent2d655683dda815021011d9dd135a263f0003bed5 (diff)
API CHANGE: remove long-deprecated Semaphore & related stuff.
osl::semaphore was not portable & thusly long-deprecated. Also killing further unused clients of that code in salhelper. Change-Id: Ie1c1924e06e8ce3be33fd1dc2c6933f2de8b5217
-rw-r--r--sal/Library_sal.mk2
-rw-r--r--sal/Package_inc.mk2
-rw-r--r--sal/inc/osl/semaphor.h91
-rw-r--r--sal/inc/osl/semaphor.hxx120
-rw-r--r--sal/osl/unx/semaphor.c126
-rw-r--r--sal/osl/unx/system.c69
-rw-r--r--sal/osl/unx/system.h25
-rw-r--r--sal/osl/w32/pipe.c1
-rw-r--r--sal/osl/w32/semaphor.c104
-rw-r--r--sal/qa/libs2test.txt1
-rw-r--r--sal/qa/osl/condition/osl_Condition_Const.h4
-rw-r--r--sal/util/sal.map5
-rw-r--r--salhelper/Package_inc.mk3
-rw-r--r--salhelper/inc/salhelper/future.hxx114
-rw-r--r--salhelper/inc/salhelper/futurequeue.hxx102
-rw-r--r--salhelper/inc/salhelper/queue.hxx178
16 files changed, 0 insertions, 947 deletions
diff --git a/sal/Library_sal.mk b/sal/Library_sal.mk
index 9c835ed153cd..72234a9d1e3f 100644
--- a/sal/Library_sal.mk
+++ b/sal/Library_sal.mk
@@ -188,7 +188,6 @@ $(eval $(call gb_Library_add_cobjects,sal,\
188 sal/osl/unx/profile \ 188 sal/osl/unx/profile \
189 sal/osl/unx/readwrite_helper \ 189 sal/osl/unx/readwrite_helper \
190 sal/osl/unx/security \ 190 sal/osl/unx/security \
191 sal/osl/unx/semaphor \
192 sal/osl/unx/socket \ 191 sal/osl/unx/socket \
193 sal/osl/unx/system \ 192 sal/osl/unx/system \
194 sal/osl/unx/tempfile \ 193 sal/osl/unx/tempfile \
@@ -258,7 +257,6 @@ $(eval $(call gb_Library_add_cobjects,sal,\
258 sal/osl/w32/nlsupport \ 257 sal/osl/w32/nlsupport \
259 sal/osl/w32/pipe \ 258 sal/osl/w32/pipe \
260 sal/osl/w32/security \ 259 sal/osl/w32/security \
261 sal/osl/w32/semaphor \
262 sal/osl/w32/thread \ 260 sal/osl/w32/thread \
263 sal/osl/w32/time \ 261 sal/osl/w32/time \
264 sal/osl/w32/util \ 262 sal/osl/w32/util \
diff --git a/sal/Package_inc.mk b/sal/Package_inc.mk
index bf17e5fead0c..0e91e08af0a4 100644
--- a/sal/Package_inc.mk
+++ b/sal/Package_inc.mk
@@ -52,8 +52,6 @@ $(eval $(call gb_Package_add_file,sal_inc,inc/osl/profile.hxx,osl/profile.hxx))
52$(eval $(call gb_Package_add_file,sal_inc,inc/osl/security_decl.hxx,osl/security_decl.hxx)) 52$(eval $(call gb_Package_add_file,sal_inc,inc/osl/security_decl.hxx,osl/security_decl.hxx))
53$(eval $(call gb_Package_add_file,sal_inc,inc/osl/security.h,osl/security.h)) 53$(eval $(call gb_Package_add_file,sal_inc,inc/osl/security.h,osl/security.h))
54$(eval $(call gb_Package_add_file,sal_inc,inc/osl/security.hxx,osl/security.hxx)) 54$(eval $(call gb_Package_add_file,sal_inc,inc/osl/security.hxx,osl/security.hxx))
55$(eval $(call gb_Package_add_file,sal_inc,inc/osl/semaphor.h,osl/semaphor.h))
56$(eval $(call gb_Package_add_file,sal_inc,inc/osl/semaphor.hxx,osl/semaphor.hxx))
57$(eval $(call gb_Package_add_file,sal_inc,inc/osl/signal.h,osl/signal.h)) 55$(eval $(call gb_Package_add_file,sal_inc,inc/osl/signal.h,osl/signal.h))
58$(eval $(call gb_Package_add_file,sal_inc,inc/osl/socket_decl.hxx,osl/socket_decl.hxx)) 56$(eval $(call gb_Package_add_file,sal_inc,inc/osl/socket_decl.hxx,osl/socket_decl.hxx))
59$(eval $(call gb_Package_add_file,sal_inc,inc/osl/socket.h,osl/socket.h)) 57$(eval $(call gb_Package_add_file,sal_inc,inc/osl/socket.h,osl/socket.h))
diff --git a/sal/inc/osl/semaphor.h b/sal/inc/osl/semaphor.h
deleted file mode 100644
index 9d46d7f702c3..000000000000
--- a/sal/inc/osl/semaphor.h
+++ /dev/null
@@ -1,91 +0,0 @@
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef _OSL_SEMAPHORE_H_
21#define _OSL_SEMAPHORE_H_
22
23#include "sal/config.h"
24
25#include "sal/saldllapi.h"
26#include "sal/types.h"
27
28#ifdef __cplusplus
29extern "C" {
30#endif
31
32typedef void* oslSemaphore;
33
34/** Creates a semaphore.<BR>
35
36 @deprecated
37 Must not be used, as unnamed semaphores are not supported on Mac OS X.
38
39 @param initialCount denotes the starting value the semaphore. If you set it to
40 zero, the first acquire() blocks. Otherwise InitialCount acquire()s are
41 immedeatly successfull.
42 @return 0 if the semaphore could not be created, otherwise a handle to the sem.
43*/
44SAL_DLLPUBLIC oslSemaphore SAL_CALL osl_createSemaphore(sal_uInt32 initialCount);
45
46/** Release the OS-structures and free semaphore data-structure
47
48 @deprecated
49 Must not be used, as unnamed semaphores are not supported on Mac OS X.
50
51 @return fbbb
52*/
53SAL_DLLPUBLIC void SAL_CALL osl_destroySemaphore(oslSemaphore Semaphore);
54
55/** acquire() decreases the count. It will block if it tries to
56 decrease below zero.
57
58 @deprecated
59 Must not be used, as unnamed semaphores are not supported on Mac OS X.
60
61 @return False if the system-call failed.
62*/
63SAL_DLLPUBLIC sal_Bool SAL_CALL osl_acquireSemaphore(oslSemaphore Semaphore);
64
65/** tryToAcquire() tries to decreases the count. It will
66 return with False if it would decrease the count below zero.
67 (When acquire() would block.) If it could successfully
68 decrease the count, it will return True.
69
70 @deprecated
71 Must not be used, as unnamed semaphores are not supported on Mac OS X.
72*/
73SAL_DLLPUBLIC sal_Bool SAL_CALL osl_tryToAcquireSemaphore(oslSemaphore Semaphore);
74
75/** release() increases the count.
76
77 @deprecated
78 Must not be used, as unnamed semaphores are not supported on Mac OS X.
79
80 @return False if the system-call failed.
81*/
82SAL_DLLPUBLIC sal_Bool SAL_CALL osl_releaseSemaphore(oslSemaphore Semaphore);
83
84#ifdef __cplusplus
85}
86#endif
87
88#endif /* _OSL_SEMAPHORE_H_ */
89
90
91/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/inc/osl/semaphor.hxx b/sal/inc/osl/semaphor.hxx
deleted file mode 100644
index 155b7b823e8b..000000000000
--- a/sal/inc/osl/semaphor.hxx
+++ /dev/null
@@ -1,120 +0,0 @@
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef _OSL_SEMAPHORE_HXX_
21#define _OSL_SEMAPHORE_HXX_
22
23#ifdef __cplusplus
24
25#include <osl/semaphor.h>
26
27
28namespace osl
29{
30 /** C++ wrapper class around C semaphore functions.
31
32 @deprecated
33 Must not be used, as unnamed semaphores are not supported on Mac OS X.
34 */
35 class Semaphore {
36
37 public:
38
39 /** Creates a semaphore.<BR>
40 @param initialCount denotes the starting value the semaphore. If you set it to
41 zero, the first acquire() blocks. Otherwise InitialCount acquire()s are
42 immedeatly successfull.
43 @return 0 if the semaphore could not be created, otherwise a handle to the sem.
44 */
45
46 Semaphore(sal_uInt32 initialCount)
47 {
48 semaphore = osl_createSemaphore(initialCount);
49 }
50
51 /** Release the OS-structures and free semaphore data-structure
52 @return fbbb
53 */
54 ~Semaphore()
55 {
56 osl_destroySemaphore(semaphore);
57 }
58
59 /** acquire() decreases the count. It will block if it tries to
60 decrease below zero.
61 @return False if the system-call failed.
62 */
63 sal_Bool acquire()
64 {
65 return osl_acquireSemaphore(semaphore);
66 }
67
68 /** tryToAcquire() tries to decreases the count. It will
69 return with False if it would decrease the count below zero.
70 (When acquire() would block.) If it could successfully
71 decrease the count, it will return True.
72 */
73 sal_Bool tryToAcquire()
74 {
75 return osl_tryToAcquireSemaphore(semaphore);
76 }
77
78 /** release() increases the count.
79 @return False if the system-call failed.
80 */
81 sal_Bool release()
82 {
83 return osl_releaseSemaphore(semaphore);
84 }
85
86 private:
87 oslSemaphore semaphore;
88
89 /** The underlying oslSemaphore has no reference count.
90
91 Since the underlying oslSemaphore is not a reference counted object, copy
92 constructed Semaphore may work on an already destructed oslSemaphore object.
93
94 */
95 Semaphore(const Semaphore&);
96
97 /** The underlying oslSemaphore has no reference count.
98
99 When destructed, the Semaphore object destroys the undelying oslSemaphore,
100 which might cause severe problems in case it's a temporary object.
101
102 */
103 Semaphore(oslSemaphore Semaphore);
104
105 /** This assignment operator is private for the same reason as
106 the copy constructor.
107 */
108 Semaphore& operator= (const Semaphore&);
109
110 /** This assignment operator is private for the same reason as
111 the constructor taking a oslSemaphore argument.
112 */
113 Semaphore& operator= (oslSemaphore);
114 };
115}
116
117#endif /* __cplusplus */
118#endif /* _OSL_SEMAPHORE_HXX_ */
119
120/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/osl/unx/semaphor.c b/sal/osl/unx/semaphor.c
deleted file mode 100644
index bff843f29725..000000000000
--- a/sal/osl/unx/semaphor.c
+++ /dev/null
@@ -1,126 +0,0 @@
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20
21#include "system.h"
22
23#include <osl/semaphor.h>
24#include <osl/diagnose.h>
25
26/* This is the (default) POSIX thread-local semaphore variant */
27
28/*
29 Implemetation notes:
30 The void* represented by oslSemaphore is used
31 as a pointer to an sem_t struct
32*/
33
34/*****************************************************************************/
35/* osl_createSemaphore */
36/*****************************************************************************/
37
38oslSemaphore SAL_CALL osl_createSemaphore(sal_uInt32 initialCount)
39{
40 int ret = 0;
41 oslSemaphore Semaphore;
42
43 Semaphore= malloc(sizeof(sem_t));
44
45 OSL_ASSERT(Semaphore); /* ptr valid? */
46
47 if ( Semaphore == 0 )
48 {
49 return 0;
50 }
51
52 /* unnamed semaphore, not shared between processes */
53
54 ret= sem_init((sem_t*)Semaphore, 0, initialCount);
55
56 /* create failed? */
57 if (ret != 0)
58 {
59 OSL_TRACE("osl_createSemaphore failed. Errno: %d; %s\n",
60 errno,
61 strerror(errno));
62
63 free(Semaphore);
64 Semaphore = NULL;
65 }
66
67 return Semaphore;
68}
69
70/*****************************************************************************/
71/* osl_destroySemaphore */
72/*****************************************************************************/
73void SAL_CALL osl_destroySemaphore(oslSemaphore Semaphore)
74{
75 if(Semaphore) /* ptr valid? */
76 {
77 sem_destroy((sem_t*)Semaphore);
78 free(Semaphore);
79 }
80}
81
82/*****************************************************************************/
83/* osl_acquireSemaphore */
84/*****************************************************************************/
85sal_Bool SAL_CALL osl_acquireSemaphore(oslSemaphore Semaphore) {
86
87 OSL_ASSERT(Semaphore != 0); /* abort in debug mode */
88
89 if (Semaphore != 0) /* be tolerant in release mode */
90 {
91 return (sem_wait((sem_t*)Semaphore) == 0);
92 }
93
94 return sal_False;
95}
96
97/*****************************************************************************/
98/* osl_tryToAcquireSemaphore */
99/*****************************************************************************/
100sal_Bool SAL_CALL osl_tryToAcquireSemaphore(oslSemaphore Semaphore) {
101
102 OSL_ASSERT(Semaphore != 0); /* abort in debug mode */
103 if (Semaphore != 0) /* be tolerant in release mode */
104 {
105 return (sem_trywait((sem_t*)Semaphore) == 0);
106 }
107
108 return sal_False;
109}
110
111/*****************************************************************************/
112/* osl_releaseSemaphore */
113/*****************************************************************************/
114sal_Bool SAL_CALL osl_releaseSemaphore(oslSemaphore Semaphore) {
115
116 OSL_ASSERT(Semaphore != 0); /* abort in debug mode */
117
118 if (Semaphore != 0) /* be tolerant in release mode */
119 {
120 return (sem_post((sem_t*)Semaphore) == 0);
121 }
122
123 return sal_False;
124}
125
126/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/osl/unx/system.c b/sal/osl/unx/system.c
index fca765566785..8c8280dff70c 100644
--- a/sal/osl/unx/system.c
+++ b/sal/osl/unx/system.c
@@ -207,75 +207,6 @@ int macxp_resolveAlias(char *path, int buflen)
207 207
208#endif /* NO_PTHREAD_RTL */ 208#endif /* NO_PTHREAD_RTL */
209 209
210#ifdef NO_PTHREAD_SEMAPHORES
211int sem_init(sem_t* sem, int pshared, unsigned int value)
212{
213 (void)pshared;
214 pthread_mutex_init(&sem->mutex, PTHREAD_MUTEXATTR_DEFAULT);
215 pthread_cond_init(&sem->increased, PTHREAD_CONDATTR_DEFAULT);
216
217 sem->value = (int)value;
218 return 0;
219}
220
221int sem_destroy(sem_t* sem)
222{
223 pthread_mutex_destroy(&sem->mutex);
224 pthread_cond_destroy(&sem->increased);
225 sem->value = 0;
226 return 0;
227}
228
229int sem_wait(sem_t* sem)
230{
231 pthread_mutex_lock(&sem->mutex);
232
233 while (sem->value <= 0)
234 {
235 pthread_cond_wait(&sem->increased, &sem->mutex);
236 }
237
238 sem->value--;
239 pthread_mutex_unlock(&sem->mutex);
240
241 return 0;
242}
243
244int sem_trywait(sem_t* sem)
245{
246 int result = 0;
247
248 pthread_mutex_lock(&sem->mutex);
249
250 if (sem->value > 0)
251 {
252 sem->value--;
253 }
254 else
255 {
256 errno = EAGAIN;
257 result = -1;
258 }
259
260 pthread_mutex_unlock(&sem->mutex);
261
262 return result;
263}
264
265int sem_post(sem_t* sem)
266{
267 pthread_mutex_lock(&sem->mutex);
268
269 sem->value++;
270
271 pthread_mutex_unlock(&sem->mutex);
272
273 pthread_cond_signal(&sem->increased);
274
275 return 0;
276}
277#endif
278
279#if defined(FREEBSD) 210#if defined(FREEBSD)
280char *fcvt(double value, int ndigit, int *decpt, int *sign) 211char *fcvt(double value, int ndigit, int *decpt, int *sign)
281{ 212{
diff --git a/sal/osl/unx/system.h b/sal/osl/unx/system.h
index 8d7e734b6c6b..057257e691f6 100644
--- a/sal/osl/unx/system.h
+++ b/sal/osl/unx/system.h
@@ -73,7 +73,6 @@
73# include <dlfcn.h> 73# include <dlfcn.h>
74# include <endian.h> 74# include <endian.h>
75# include <sys/time.h> 75# include <sys/time.h>
76# include <semaphore.h>
77# if __BYTE_ORDER == __LITTLE_ENDIAN 76# if __BYTE_ORDER == __LITTLE_ENDIAN
78# define _LITTLE_ENDIAN 77# define _LITTLE_ENDIAN
79# elif __BYTE_ORDER == __BIG_ENDIAN 78# elif __BYTE_ORDER == __BIG_ENDIAN
@@ -103,7 +102,6 @@
103# include <dlfcn.h> 102# include <dlfcn.h>
104# include <endian.h> 103# include <endian.h>
105# include <sys/time.h> 104# include <sys/time.h>
106# include <semaphore.h>
107# define IORESOURCE_TRANSFER_BSD 105# define IORESOURCE_TRANSFER_BSD
108# define IOCHANNEL_TRANSFER_BSD_RENO 106# define IOCHANNEL_TRANSFER_BSD_RENO
109# define pthread_testcancel() 107# define pthread_testcancel()
@@ -118,7 +116,6 @@
118# define ETIME ETIMEDOUT 116# define ETIME ETIMEDOUT
119# include <pthread.h> 117# include <pthread.h>
120# include <sys/sem.h> 118# include <sys/sem.h>
121# include <semaphore.h>
122# include <dlfcn.h> 119# include <dlfcn.h>
123# include <sys/filio.h> 120# include <sys/filio.h>
124# include <sys/ioctl.h> 121# include <sys/ioctl.h>
@@ -148,7 +145,6 @@
148# define ETIME ETIMEDOUT 145# define ETIME ETIMEDOUT
149# include <pthread.h> 146# include <pthread.h>
150# include <sys/sem.h> 147# include <sys/sem.h>
151# include <semaphore.h>
152# include <dlfcn.h> 148# include <dlfcn.h>
153# include <sys/filio.h> 149# include <sys/filio.h>
154# include <sys/ioctl.h> 150# include <sys/ioctl.h>
@@ -173,7 +169,6 @@
173# define ETIME ETIMEDOUT 169# define ETIME ETIMEDOUT
174# include <pthread.h> 170# include <pthread.h>
175# include <sys/sem.h> 171# include <sys/sem.h>
176# include <semaphore.h>
177# include <dlfcn.h> 172# include <dlfcn.h>
178# include <sys/filio.h> 173# include <sys/filio.h>
179# include <sys/ioctl.h> 174# include <sys/ioctl.h>
@@ -208,7 +203,6 @@
208# endif 203# endif
209# define SLEEP_TIMESPEC(timespec) nsleep(&timespec, 0) 204# define SLEEP_TIMESPEC(timespec) nsleep(&timespec, 0)
210# define LIBPATH "LIBPATH" 205# define LIBPATH "LIBPATH"
211# define NO_PTHREAD_SEMAPHORES
212#endif 206#endif
213 207
214#ifdef SOLARIS 208#ifdef SOLARIS
@@ -216,7 +210,6 @@
216# include <sys/un.h> 210# include <sys/un.h>
217# include <stropts.h> 211# include <stropts.h>
218# include <pthread.h> 212# include <pthread.h>
219# include <semaphore.h>
220# include <netinet/tcp.h> 213# include <netinet/tcp.h>
221# include <sys/filio.h> 214# include <sys/filio.h>
222# include <dlfcn.h> 215# include <dlfcn.h>
@@ -243,7 +236,6 @@
243# include <netinet/tcp.h> 236# include <netinet/tcp.h>
244# include <machine/endian.h> 237# include <machine/endian.h>
245# include <sys/time.h> 238# include <sys/time.h>
246# include <sys/semaphore.h>
247/* fixme are premac and postmac still needed here? */ 239/* fixme are premac and postmac still needed here? */
248# include <premac.h> 240# include <premac.h>
249# include <mach-o/dyld.h> 241# include <mach-o/dyld.h>
@@ -283,7 +275,6 @@ int macxp_resolveAlias(char *path, int buflen);
283# include <netinet/tcp.h> 275# include <netinet/tcp.h>
284# include <machine/endian.h> 276# include <machine/endian.h>
285# include <sys/time.h> 277# include <sys/time.h>
286# include <sys/semaphore.h>
287# if BYTE_ORDER == LITTLE_ENDIAN 278# if BYTE_ORDER == LITTLE_ENDIAN
288# ifndef _LITTLE_ENDIAN 279# ifndef _LITTLE_ENDIAN
289# define _LITTLE_ENDIAN 280# define _LITTLE_ENDIAN
@@ -403,22 +394,6 @@ typedef struct sockaddr_ipx {
403 394
404/* END HACK */ 395/* END HACK */
405 396
406#ifdef NO_PTHREAD_SEMAPHORES
407
408typedef struct
409{
410 pthread_mutex_t mutex;
411 pthread_cond_t increased;
412 int value;
413} sem_t;
414extern int sem_init(sem_t* sem, int pshared, unsigned int value);
415extern int sem_destroy(sem_t* sem);
416extern int sem_wait(sem_t* sem);
417extern int sem_trywait(sem_t* sem);
418extern int sem_post(sem_t* sem);
419
420#endif
421
422#ifdef NO_PTHREAD_RTL 397#ifdef NO_PTHREAD_RTL
423#if !defined FREEBSD || (__FreeBSD_version < 500112) 398#if !defined FREEBSD || (__FreeBSD_version < 500112)
424#if !defined NETBSD 399#if !defined NETBSD
diff --git a/sal/osl/w32/pipe.c b/sal/osl/w32/pipe.c
index 62125b9ddb81..149de07f73ce 100644
--- a/sal/osl/w32/pipe.c
+++ b/sal/osl/w32/pipe.c
@@ -25,7 +25,6 @@
25#include <osl/diagnose.h> 25#include <osl/diagnose.h>
26#include <osl/thread.h> 26#include <osl/thread.h>
27#include <osl/mutex.h> 27#include <osl/mutex.h>
28#include <osl/semaphor.h>
29#include <osl/conditn.h> 28#include <osl/conditn.h>
30#include <osl/interlck.h> 29#include <osl/interlck.h>
31#include <osl/process.h> 30#include <osl/process.h>
diff --git a/sal/osl/w32/semaphor.c b/sal/osl/w32/semaphor.c
deleted file mode 100644
index de3828b31e8f..000000000000
--- a/sal/osl/w32/semaphor.c
+++ /dev/null
@@ -1,104 +0,0 @@
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#include "system.h"
21
22#include <osl/diagnose.h>
23#include <osl/semaphor.h>
24
25/*
26 Implemetation notes:
27 The void* represented by oslSemaphore is used
28 to store a WIN32 HANDLE.
29*/
30
31
32/*****************************************************************************/
33/* osl_createSemaphore */
34/*****************************************************************************/
35oslSemaphore SAL_CALL osl_createSemaphore(sal_uInt32 initialCount)
36{
37 oslSemaphore Semaphore;
38
39 Semaphore= CreateSemaphore(0, initialCount, INT_MAX, 0);
40
41 /* create failed? */
42 if((HANDLE)Semaphore == INVALID_HANDLE_VALUE)
43 {
44 Semaphore= 0;
45 }
46
47 return Semaphore;
48}
49
50/*****************************************************************************/
51/* osl_destroySemaphore */
52/*****************************************************************************/
53void SAL_CALL osl_destroySemaphore(oslSemaphore Semaphore)
54{
55
56
57 if(Semaphore != 0)
58 {
59 CloseHandle((HANDLE)Semaphore);
60 }
61
62}
63
64/*****************************************************************************/
65/* osl_acquireSemaphore */
66/*****************************************************************************/
67sal_Bool SAL_CALL osl_acquireSemaphore(oslSemaphore Semaphore)
68{
69 OSL_ASSERT(Semaphore != 0);
70
71 switch ( WaitForSingleObject( (HANDLE)Semaphore, INFINITE ) )
72 {
73 case WAIT_OBJECT_0:
74 return sal_True;
75
76 default:
77 return (sal_False);
78 }
79}
80
81/*****************************************************************************/
82/* osl_tryToAcquireSemaphore */
83/*****************************************************************************/
84sal_Bool SAL_CALL osl_tryToAcquireSemaphore(oslSemaphore Semaphore)
85{
86 OSL_ASSERT(Semaphore != 0);
87 return (sal_Bool)(WaitForSingleObject((HANDLE)Semaphore, 0) == WAIT_OBJECT_0);
88}
89
90
91/*****************************************************************************/
92/* osl_releaseSemaphore */
93/*****************************************************************************/
94sal_Bool SAL_CALL osl_releaseSemaphore(oslSemaphore Semaphore)
95{
96 OSL_ASSERT(Semaphore != 0);
97
98 /* increase count by one, not interested in previous count */
99 return (sal_Bool)(ReleaseSemaphore((HANDLE)Semaphore, 1, NULL) != FALSE);
100}
101
102
103
104/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sal/qa/libs2test.txt b/sal/qa/libs2test.txt
index 2f8a01fb592d..d41bf062f491 100644
--- a/sal/qa/libs2test.txt
+++ b/sal/qa/libs2test.txt
@@ -53,7 +53,6 @@ osl/socket ; osl_AcceptorSocket
53 53
54osl/mutex ; osl_Mutex 54osl/mutex ; osl_Mutex
55osl/pipe ; osl_Pipe 55osl/pipe ; osl_Pipe
56osl/semaphore ; osl_Semaphore
57osl/condition ; osl_Condition 56osl/condition ; osl_Condition
58osl/module ; osl_Module 57osl/module ; osl_Module
59osl/security ; osl_Security 58osl/security ; osl_Security
diff --git a/sal/qa/osl/condition/osl_Condition_Const.h b/sal/qa/osl/condition/osl_Condition_Const.h
index 9443ec359c60..6101914fa9a6 100644
--- a/sal/qa/osl/condition/osl_Condition_Const.h
+++ b/sal/qa/osl/condition/osl_Condition_Const.h
@@ -29,10 +29,6 @@
29#include <osl/mutex.hxx> 29#include <osl/mutex.hxx>
30#include <osl/pipe.hxx> 30#include <osl/pipe.hxx>
31 31
32#ifndef _OSL_SEMAPHOR_HXX_
33#include <osl/semaphor.hxx>
34#endif
35
36#ifndef _OSL_CONDITION_HXX_ 32#ifndef _OSL_CONDITION_HXX_
37#include <osl/conditn.hxx> 33#include <osl/conditn.hxx>
38#endif 34#endif
diff --git a/sal/util/sal.map b/sal/util/sal.map
index 3c5e787ed35a..47dfe39897bd 100644
--- a/sal/util/sal.map
+++ b/sal/util/sal.map
@@ -25,7 +25,6 @@ UDK_3_0_0 {
25 osl_acquireSocket; 25 osl_acquireSocket;
26 osl_acquirePipe; 26 osl_acquirePipe;
27 osl_acquireMutex; 27 osl_acquireMutex;
28 osl_acquireSemaphore;
29 osl_addSignalHandler; 28 osl_addSignalHandler;
30 osl_addToSocketSet; 29 osl_addToSocketSet;
31 osl_assertFailedLine; 30 osl_assertFailedLine;
@@ -47,7 +46,6 @@ UDK_3_0_0 {
47 osl_createInetSocketAddr; 46 osl_createInetSocketAddr;
48 osl_createMutex; 47 osl_createMutex;
49 osl_createPipe; 48 osl_createPipe;
50 osl_createSemaphore;
51 osl_createSocket; 49 osl_createSocket;
52 osl_createSocketSet; 50 osl_createSocketSet;
53 osl_createSuspendedThread; 51 osl_createSuspendedThread;
@@ -58,7 +56,6 @@ UDK_3_0_0 {
58 osl_destroyCondition; 56 osl_destroyCondition;
59 osl_destroyHostAddr; 57 osl_destroyHostAddr;
60 osl_destroyMutex; 58 osl_destroyMutex;
61 osl_destroySemaphore;
62 osl_destroySocketAddr; 59 osl_destroySocketAddr;
63 osl_destroySocketSet; 60 osl_destroySocketSet;
64 osl_destroyThread; 61 osl_destroyThread;
@@ -144,7 +141,6 @@ UDK_3_0_0 {
144 osl_releaseDirectoryItem; 141 osl_releaseDirectoryItem;
145 osl_releaseMutex; 142 osl_releaseMutex;
146 osl_releasePipe; 143 osl_releasePipe;
147 osl_releaseSemaphore;
148 osl_releaseSocket; 144 osl_releaseSocket;
149 osl_removeFromSocketSet; 145 osl_removeFromSocketSet;
150 osl_removeProfileEntry; 146 osl_removeProfileEntry;
@@ -173,7 +169,6 @@ UDK_3_0_0 {
173 osl_terminateThread; 169 osl_terminateThread;
174 osl_trace; 170 osl_trace;
175 osl_tryToAcquireMutex; 171 osl_tryToAcquireMutex;
176 osl_tryToAcquireSemaphore;
177 osl_unloadModule; 172 osl_unloadModule;
178 osl_waitCondition; 173 osl_waitCondition;
179 osl_waitThread; 174 osl_waitThread;
diff --git a/salhelper/Package_inc.mk b/salhelper/Package_inc.mk
index 4950c69d7311..7a30c7fc967d 100644
--- a/salhelper/Package_inc.mk
+++ b/salhelper/Package_inc.mk
@@ -30,10 +30,7 @@ $(eval $(call gb_Package_Package,salhelper_inc,$(SRCDIR)/salhelper/inc/salhelper
30$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/salhelperdllapi.h,salhelperdllapi.h)) 30$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/salhelperdllapi.h,salhelperdllapi.h))
31$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/condition.hxx,condition.hxx)) 31$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/condition.hxx,condition.hxx))
32$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/dynload.hxx,dynload.hxx)) 32$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/dynload.hxx,dynload.hxx))
33$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/future.hxx,future.hxx))
34$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/futurequeue.hxx,futurequeue.hxx))
35$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/linkhelper.hxx,linkhelper.hxx)) 33$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/linkhelper.hxx,linkhelper.hxx))
36$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/queue.hxx,queue.hxx))
37$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/refobj.hxx,refobj.hxx)) 34$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/refobj.hxx,refobj.hxx))
38$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/simplereferenceobject.hxx,simplereferenceobject.hxx)) 35$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/simplereferenceobject.hxx,simplereferenceobject.hxx))
39$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/singletonref.hxx,singletonref.hxx)) 36$(eval $(call gb_Package_add_file,salhelper_inc,inc/salhelper/singletonref.hxx,singletonref.hxx))
diff --git a/salhelper/inc/salhelper/future.hxx b/salhelper/inc/salhelper/future.hxx
deleted file mode 100644
index 0b97fd158ab6..000000000000
--- a/salhelper/inc/salhelper/future.hxx
+++ /dev/null
@@ -1,114 +0,0 @@
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef _SALHELPER_FUTURE_HXX_
21#define _SALHELPER_FUTURE_HXX_
22
23#include <sal/types.h>
24#include <osl/diagnose.h>
25#include <osl/conditn.hxx>
26#include <salhelper/refobj.hxx>
27
28namespace salhelper
29{
30
31//----------------------------------------------------------------------------
32
33#ifndef SALHELPER_COPYCTOR_API
34#define SALHELPER_COPYCTOR_API(C) C (const C&); C& operator= (const C&)
35#endif
36
37//----------------------------------------------------------------------------
38
39template<class value_type>
40class FutureValue : protected osl::Condition
41{
42 /** Representation.
43 */
44 value_type m_aValue;
45
46 /** Not implemented.
47 */
48 SALHELPER_COPYCTOR_API(FutureValue<value_type>);
49
50public:
51 inline FutureValue (const value_type& value = value_type()) SAL_THROW(())
52 : m_aValue (value)
53 {
54 Condition::reset();
55 }
56
57 inline ~FutureValue() SAL_THROW(())
58 {}
59
60 inline sal_Bool is() const SAL_THROW(())
61 {
62 return const_cast<FutureValue*>(this)->check();
63 }
64
65 inline void set (const value_type& value) SAL_THROW(())
66 {
67 m_aValue = value;
68 Condition::set();
69 }
70
71 inline value_type& get() SAL_THROW(())
72 {
73 Condition::wait();
74 return m_aValue;
75 }
76};
77
78//----------------------------------------------------------------------------
79
80template<class value_type>
81class Future : public salhelper::ReferenceObject
82{
83 /** Representation.
84 */
85 FutureValue<value_type> m_aValue;
86
87 /** Not implemented.
88 */
89 SALHELPER_COPYCTOR_API(Future<value_type>);
90
91public:
92 inline Future (const value_type& value = value_type()) SAL_THROW(())
93 : m_aValue (value)
94 {}
95
96 inline void set (const value_type& value) SAL_THROW(())
97 {
98 OSL_PRECOND(!m_aValue.is(), "Future::set(): value already set");
99 m_aValue.set (value);
100 }
101
102 inline value_type& get() SAL_THROW(())
103 {
104 return m_aValue.get();
105 }
106};
107
108//----------------------------------------------------------------------------
109
110} // namespace salhelper
111
112#endif /* !_SALHELPER_FUTURE_HXX_ */
113
114/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/salhelper/inc/salhelper/futurequeue.hxx b/salhelper/inc/salhelper/futurequeue.hxx
deleted file mode 100644
index c54a6a335a92..000000000000
--- a/salhelper/inc/salhelper/futurequeue.hxx
+++ /dev/null
@@ -1,102 +0,0 @@
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef _SALHELPER_FUTUREQUEUE_HXX_
21#define _SALHELPER_FUTUREQUEUE_HXX_
22
23#include <sal/types.h>
24#include <rtl/ref.hxx>
25#include <osl/mutex.hxx>
26#include <salhelper/future.hxx>
27#include <salhelper/queue.hxx>
28
29namespace salhelper
30{
31
32//----------------------------------------------------------------------------
33
34#ifndef SALHELPER_COPYCTOR_API
35#define SALHELPER_COPYCTOR_API(C) C (const C&); C& operator= (const C&)
36#endif
37
38//----------------------------------------------------------------------------
39
40template<class element_type>
41class FutureQueue : protected osl::Mutex
42{
43 /** Representation.
44 */
45 typedef salhelper::Future<element_type> future_type;
46
47 salhelper::QueueBase< rtl::Reference<future_type> > m_aDelayed;
48 salhelper::QueueBase< rtl::Reference<future_type> > m_aPresent;
49
50 /** Not implemented.
51 */
52 SALHELPER_COPYCTOR_API(FutureQueue<element_type>);
53
54public:
55 /** Construction.
56 */
57 inline FutureQueue()
58 {}
59
60 /** Destruction.
61 */
62 inline ~FutureQueue()
63 {}
64
65 /** Enqueue element at queue tail.
66 */
67 inline void put (const element_type& element)
68 {
69 osl::MutexGuard aGuard (*this);
70
71 rtl::Reference<future_type> xFuture (m_aDelayed.get());
72 if (!xFuture.is())
73 {
74 xFuture = new future_type();
75 m_aPresent.put (xFuture);
76 }
77 xFuture->set (element);
78 }
79
80 /** Dequeue a future to element at queue head.
81 */
82 inline rtl::Reference< salhelper::Future<element_type> > get()
83 {
84 osl::MutexGuard aGuard (*this);
85
86 rtl::Reference<future_type> xFuture (m_aPresent.get());
87 if (!xFuture.is())
88 {
89 xFuture = new future_type();
90 m_aDelayed.put (xFuture);
91 }
92 return (xFuture);
93 }
94};
95
96//----------------------------------------------------------------------------
97
98} // namespace salhelper
99
100#endif /* !_SALHELPER_FUTUREQUEUE */
101
102/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/salhelper/inc/salhelper/queue.hxx b/salhelper/inc/salhelper/queue.hxx
deleted file mode 100644
index 444b09fb5037..000000000000
--- a/salhelper/inc/salhelper/queue.hxx
+++ /dev/null
@@ -1,178 +0,0 @@
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19
20#ifndef _SALHELPER_QUEUE_HXX_
21#define _SALHELPER_QUEUE_HXX_
22
23#include <sal/types.h>
24#include <osl/diagnose.h>
25#include <osl/mutex.hxx>
26#include <osl/semaphor.hxx>
27
28#ifndef __LIST__
29#include <list>
30#endif
31
32namespace salhelper
33{
34
35//----------------------------------------------------------------------------
36
37#ifndef SALHELPER_COPYCTOR_API
38#define SALHELPER_COPYCTOR_API(C) C (const C&); C& operator= (const C&)
39#endif
40
41//----------------------------------------------------------------------------
42
43template<class element_type>
44class QueueBase : protected std::list<element_type>
45{
46 /** Representation.
47 */
48 osl::Mutex m_aMutex;
49
50 /** Not implemented.
51 */
52 SALHELPER_COPYCTOR_API(QueueBase<element_type>);
53
54public:
55 inline QueueBase()
56 {}
57
58 inline ~QueueBase()
59 {
60 erase (this->begin(), this->end());
61 }
62
63 inline void put (const element_type& element)
64 {
65 osl::MutexGuard aGuard (m_aMutex);
66 push_back (element);
67 }
68
69 inline element_type get()
70 {
71 element_type element;
72
73 osl::MutexGuard aGuard (m_aMutex);
74 if (!this->empty())
75 {
76 element = this->front();
77 this->pop_front();
78 }
79
80 return (element);
81 }
82};
83
84//----------------------------------------------------------------------------
85
86/** Queue.
87
88 @deprecated
89 Must not be used, as it internally uses unnamed semaphores, which are not
90 supported on Mac OS X.
91*/
92template<class element_type>
93class Queue : protected QueueBase<element_type>
94{
95 /** Representation.
96 */
97 osl::Semaphore m_aNotEmpty;
98
99 /** Not implemented.
100 */
101 SALHELPER_COPYCTOR_API(Queue<element_type>);
102
103public:
104 inline Queue() : m_aNotEmpty (static_cast< sal_uInt32 >(0))
105 {}
106
107 inline ~Queue()
108 {}
109
110 inline void put (const element_type& element)
111 {
112 QueueBase<element_type>::put (element);
113 m_aNotEmpty.release();
114 }
115
116 inline element_type get()
117 {
118 element_type element;
119
120 m_aNotEmpty.acquire();
121 element = QueueBase<element_type>::get();
122
123 return (element);
124 }
125};
126
127//----------------------------------------------------------------------------
128
129/** Bounded queue.
130
131 @deprecated
132 Must not be used, as it internally uses unnamed semaphores, which are not
133 supported on Mac OS X.
134*/
135template<class element_type>
136class BoundedQueue : protected Queue<element_type>
137{
138 /** Representation.
139 */
140 osl::Semaphore m_aNotFull;
141
142 /** Not implemented.
143 */
144 SALHELPER_COPYCTOR_API(BoundedQueue<element_type>);
145
146public:
147 inline BoundedQueue (sal_uInt32 capacity) : m_aNotFull (capacity)
148 {
149 OSL_POSTCOND(capacity, "BoundedQueue:BoundedQueue(): no capacity");
150 }
151
152 inline ~BoundedQueue()
153 {}
154
155 inline void put (const element_type& element)
156 {
157 m_aNotFull.acquire();
158 Queue<element_type>::put (element);
159 }
160
161 inline element_type get()
162 {
163 element_type element;
164
165 element = Queue<element_type>::get();
166 m_aNotFull.release();
167
168 return (element);
169 }
170};
171
172//----------------------------------------------------------------------------
173
174} // namespace salhelper
175
176#endif /* !_SALHELPER_QUEUE_HXX_ */
177
178/* vim:set shiftwidth=4 softtabstop=4 expandtab: */