Lines Matching refs:instance

47   sys_mutex_lock(&call_data->threadsync_node->instance->sem_usage_mutex);
48 call_data->threadsync_node->instance->sync_fn(fn, call_data);
49 sys_sem_wait(&call_data->threadsync_node->instance->sem);
50 sys_mutex_unlock(&call_data->threadsync_node->instance->sem_usage_mutex);
60 sys_sem_signal(&call_data->threadsync_node->instance->sem);
64 threadsync_get_value(struct snmp_node_instance* instance, void* value)
66 struct threadsync_data *call_data = (struct threadsync_data*)instance->reference.ptr;
81 sys_sem_signal(&call_data->threadsync_node->instance->sem);
85 threadsync_set_test(struct snmp_node_instance* instance, u16_t len, void *value)
87 struct threadsync_data *call_data = (struct threadsync_data*)instance->reference.ptr;
103 sys_sem_signal(&call_data->threadsync_node->instance->sem);
107 threadsync_set_value(struct snmp_node_instance* instance, u16_t len, void *value)
109 struct threadsync_data *call_data = (struct threadsync_data*)instance->reference.ptr;
125 sys_sem_signal(&call_data->threadsync_node->instance->sem);
129 threadsync_release_instance(struct snmp_node_instance *instance)
131 struct threadsync_data *call_data = (struct threadsync_data*)instance->reference.ptr;
146 sys_sem_signal(&call_data->threadsync_node->instance->sem);
157 sys_sem_signal(&call_data->threadsync_node->instance->sem);
161 do_sync(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance, snmp_threadsync_called_fn fn)
163 const struct snmp_threadsync_node *threadsync_node = (const struct snmp_threadsync_node*)(const void*)instance->node;
164 struct threadsync_data *call_data = &threadsync_node->instance->data;
173 instance->reference.ptr = call_data;
174 snmp_oid_assign(&call_data->proxy_instance.instance_oid, instance->instance_oid.id, instance->instance_oid.len);
184 instance->access = call_data->proxy_instance.access;
185 instance->asn1_type = call_data->proxy_instance.asn1_type;
186 instance->release_instance = threadsync_release_instance;
187 instance->get_value = (call_data->proxy_instance.get_value != NULL)? threadsync_get_value : NULL;
188 instance->set_value = (call_data->proxy_instance.set_value != NULL)? threadsync_set_value : NULL;
189 instance->set_test = (call_data->proxy_instance.set_test != NULL)? threadsync_set_test : NULL;
190 snmp_oid_assign(&instance->instance_oid, call_data->proxy_instance.instance_oid.id, call_data->proxy_instance.instance_oid.len);
197 snmp_threadsync_get_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance)
199 return do_sync(root_oid, root_oid_len, instance, get_instance_synced);
203 snmp_threadsync_get_next_instance(const u32_t *root_oid, u8_t root_oid_len, struct snmp_node_instance* instance)
205 return do_sync(root_oid, root_oid_len, instance, get_next_instance_synced);
208 /** Initializes thread synchronization instance */
209 void snmp_threadsync_init(struct snmp_threadsync_instance *instance, snmp_threadsync_synchronizer_fn sync_fn)
211 err_t err = sys_mutex_new(&instance->sem_usage_mutex);
213 err = sys_sem_new(&instance->sem, 0);
216 instance->sync_fn = sync_fn;