MCPcopy Create free account
hub / github.com/OAID/Tengine / CreateEvent

Method CreateEvent

core/lib/notify_instance.cpp:58–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

56}
57
58int NotifyBus::CreateEvent(const std::string& name)
59{
60 if(name.size() == 0)
61 return -1;
62
63 LockNameMap();
64
65 if(name_map_.count(name))
66 {
67 UnLockNameMap();
68 return -1;
69 }
70
71 int i = 0;
72
73 for(i = 0; i < max_event_type_; i++)
74 if(event_array_[i].event < 0)
75 break;
76
77 if(i == max_event_type_)
78 {
79 UnLockNameMap();
80 return -1;
81 }
82
83 /* it is safe to work on the event, since no one should touch it */
84
85 name_map_[name] = i;
86 event_array_[i].event = i;
87 event_array_[i].name = name;
88 ResetEventStats(&event_array_[i]);
89
90 UnLockNameMap();
91
92 return i;
93}
94
95int NotifyBus::GetPendingCount(EventNode* node)
96{

Callers 2

test_singleFunction · 0.80
test_threadsFunction · 0.80

Calls 2

ResetEventStatsFunction · 0.85
sizeMethod · 0.45

Tested by 2

test_singleFunction · 0.64
test_threadsFunction · 0.64