A
lgorithmique
N
umérique
D
istribuée
Public GIT Repository
projects
/
simgrid.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Update python/clusters-multicpu to the new API.
[simgrid.git]
/
include
/
simgrid
/
s4u
/
Semaphore.hpp
diff --git
a/include/simgrid/s4u/Semaphore.hpp
b/include/simgrid/s4u/Semaphore.hpp
index b100ba560dc500fa62cbd45a97f531ea9c14cf62..4c16f7ae9c5897e5d3f4465731fb950aad2638b4 100644
(file)
--- a/
include/simgrid/s4u/Semaphore.hpp
+++ b/
include/simgrid/s4u/Semaphore.hpp
@@
-1,4
+1,4
@@
-/* Copyright (c) 2006-202
1
. The SimGrid Team. All rights reserved. */
+/* Copyright (c) 2006-202
3
. The SimGrid Team. All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
/* This program is free software; you can redistribute it and/or modify it
* under the terms of the license (GNU LGPL) which comes with this package. */
@@
-7,10
+7,8
@@
#define SIMGRID_S4U_SEMAPHORE_HPP
#include <simgrid/forward.h>
#define SIMGRID_S4U_SEMAPHORE_HPP
#include <simgrid/forward.h>
-#include <simgrid/simix.h>
-namespace simgrid {
-namespace s4u {
+namespace simgrid::s4u {
/** @brief A classical semaphore, but blocking in the simulation world
*
/** @brief A classical semaphore, but blocking in the simulation world
*
@@
-29,31
+27,35
@@
namespace s4u {
*
*/
class XBT_PUBLIC Semaphore {
*
*/
class XBT_PUBLIC Semaphore {
+#ifndef DOXYGEN
friend kernel::activity::SemaphoreImpl;
friend kernel::activity::SemaphoreImpl;
+ friend XBT_PUBLIC void kernel::activity::intrusive_ptr_release(kernel::activity::SemaphoreImpl* sem);
+#endif
kernel::activity::SemaphoreImpl* const pimpl_;
kernel::activity::SemaphoreImpl* const pimpl_;
- friend void intrusive_ptr_add_ref(const Semaphore* sem);
- friend void intrusive_ptr_release(const Semaphore* sem);
+ friend
XBT_PUBLIC
void intrusive_ptr_add_ref(const Semaphore* sem);
+ friend
XBT_PUBLIC
void intrusive_ptr_release(const Semaphore* sem);
explicit Semaphore(kernel::activity::SemaphoreImpl* sem) : pimpl_(sem) {}
explicit Semaphore(kernel::activity::SemaphoreImpl* sem) : pimpl_(sem) {}
+ ~Semaphore() = default;
#ifndef DOXYGEN
Semaphore(Semaphore const&) = delete; // No copy constructor. Use SemaphorePtr instead
Semaphore& operator=(Semaphore const&) = delete; // No direct assignment either. Use SemaphorePtr instead
#endif
public:
#ifndef DOXYGEN
Semaphore(Semaphore const&) = delete; // No copy constructor. Use SemaphorePtr instead
Semaphore& operator=(Semaphore const&) = delete; // No direct assignment either. Use SemaphorePtr instead
#endif
public:
- /** Constructs a new semaphore */
+ /**
\static
Constructs a new semaphore */
static SemaphorePtr create(unsigned int initial_capacity);
void acquire();
static SemaphorePtr create(unsigned int initial_capacity);
void acquire();
+ /** Returns true if there was a timeout */
bool acquire_timeout(double timeout);
void release();
int get_capacity() const;
bool would_block() const;
};
bool acquire_timeout(double timeout);
void release();
int get_capacity() const;
bool would_block() const;
};
-} // namespace s4u
-} // namespace simgrid
+} // namespace simgrid::s4u
#endif /* SIMGRID_S4U_SEMAPHORE_HPP */
#endif /* SIMGRID_S4U_SEMAPHORE_HPP */