projects
/
feisty_meow.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
working on terminal title bug
[feisty_meow.git]
/
octopi
/
library
/
octopus
/
tentacle.cpp
diff --git
a/octopi/library/octopus/tentacle.cpp
b/octopi/library/octopus/tentacle.cpp
index 7c618033de97b43d6e062c855a7255857634f144..beb2fb4e07af6d444cf22a1a77fabb6c18873382 100644
(file)
--- a/
octopi/library/octopus/tentacle.cpp
+++ b/
octopi/library/octopus/tentacle.cpp
@@
-19,10
+19,12
@@
#include <basis/astring.h>
#include <basis/mutex.h>
#include <basis/astring.h>
#include <basis/mutex.h>
+#include <loggers/program_wide_logger.h>
#include <processes/ethread.h>
#include <structures/amorph.h>
using namespace basis;
#include <processes/ethread.h>
#include <structures/amorph.h>
using namespace basis;
+using namespace loggers;
using namespace processes;
using namespace structures;
using namespace processes;
using namespace structures;
@@
-73,8
+75,8
@@
tentacle::tentacle(const string_array &group_name, bool backgrounded,
: _group(new string_array(group_name)),
_pending(new queueton),
_input_guard(new mutex),
: _group(new string_array(group_name)),
_pending(new queueton),
_input_guard(new mutex),
- _action(N
IL
),
- _products(N
IL
),
+ _action(N
ULL_POINTER
),
+ _products(N
ULL_POINTER
),
_backgrounded(backgrounded)
{
// we only start the thread if they've said they'll support backgrounding.
_backgrounded(backgrounded)
{
// we only start the thread if they've said they'll support backgrounding.
@@
-99,28
+101,28
@@
const char *tentacle::outcome_name(const outcome &to_name)
int tentacle::motivational_rate() const
{ if (_action) return _action->sleep_time(); else return 0; }
int tentacle::motivational_rate() const
{ if (_action) return _action->sleep_time(); else return 0; }
+entity_data_bin *tentacle::get_storage() { return _products; }
+
void tentacle::attach_storage(entity_data_bin &storage)
{
_products = &storage;
void tentacle::attach_storage(entity_data_bin &storage)
{
_products = &storage;
- if (_action) _action->start(N
IL
);
+ if (_action) _action->start(N
ULL_POINTER
);
}
void tentacle::detach_storage()
{
if (_action) _action->stop();
}
void tentacle::detach_storage()
{
if (_action) _action->stop();
- _products = N
IL
;
+ _products = N
ULL_POINTER
;
}
bool tentacle::store_product(infoton *product,
const octopus_request_id &original_id)
{
}
bool tentacle::store_product(infoton *product,
const octopus_request_id &original_id)
{
-#ifdef DEBUG_TENTACLE
FUNCDEF("store_product");
FUNCDEF("store_product");
-#endif
if (!_products) {
if (!_products) {
-#ifdef DEBUG_TENTACLE
+
//
#ifdef DEBUG_TENTACLE
LOG("storage bunker has not been established!");
LOG("storage bunker has not been established!");
-#endif
+
//
#endif
return false;
}
return _products->add_item(product, original_id);
return false;
}
return _products->add_item(product, original_id);
@@
-156,9
+158,9
@@
outcome tentacle::enqueue(infoton *to_chow, const octopus_request_id &item_id)
infoton *tentacle::next_request(octopus_request_id &item_id)
{
GRAB_CONSUMER_LOCK;
infoton *tentacle::next_request(octopus_request_id &item_id)
{
GRAB_CONSUMER_LOCK;
- if (!_pending->elements()) return N
IL
; // nothing to return.
+ if (!_pending->elements()) return N
ULL_POINTER
; // nothing to return.
infoton *to_return = (*_pending)[0]->_product;
infoton *to_return = (*_pending)[0]->_product;
- (*_pending)[0]->_product = N
IL
;
+ (*_pending)[0]->_product = N
ULL_POINTER
;
// clean out so destructor doesn't delete the object.
item_id = (*_pending)[0]->_id;
_pending->zap(0, 0);
// clean out so destructor doesn't delete the object.
item_id = (*_pending)[0]->_id;
_pending->zap(0, 0);
@@
-167,10
+169,8
@@
infoton *tentacle::next_request(octopus_request_id &item_id)
void tentacle::propel_arm()
{
void tentacle::propel_arm()
{
-#ifdef DEBUG_TENTACLE
FUNCDEF("propel_arm");
FUNCDEF("propel_arm");
-#endif
- infoton *next_item = NIL;
+ infoton *next_item = NULL_POINTER;
do {
octopus_request_id id;
next_item = next_request(id);
do {
octopus_request_id id;
next_item = next_request(id);