… | |
… | |
163 | C<ev_embeddable_backends () & ev_supported_backends ()>, likewise for |
163 | C<ev_embeddable_backends () & ev_supported_backends ()>, likewise for |
164 | recommended ones. |
164 | recommended ones. |
165 | |
165 | |
166 | See the description of C<ev_embed> watchers for more info. |
166 | See the description of C<ev_embed> watchers for more info. |
167 | |
167 | |
168 | =item ev_set_allocator (void *(*cb)(void *ptr, size_t size)) |
168 | =item ev_set_allocator (void *(*cb)(void *ptr, long size)) |
169 | |
169 | |
170 | Sets the allocation function to use (the prototype and semantics are |
170 | Sets the allocation function to use (the prototype is similar - the |
171 | identical to the realloc C function). It is used to allocate and free |
171 | semantics is identical - to the realloc C function). It is used to |
172 | memory (no surprises here). If it returns zero when memory needs to be |
172 | allocate and free memory (no surprises here). If it returns zero when |
173 | allocated, the library might abort or take some potentially destructive |
173 | memory needs to be allocated, the library might abort or take some |
174 | action. The default is your system realloc function. |
174 | potentially destructive action. The default is your system realloc |
|
|
175 | function. |
175 | |
176 | |
176 | You could override this function in high-availability programs to, say, |
177 | You could override this function in high-availability programs to, say, |
177 | free some memory if it cannot allocate memory, to use a special allocator, |
178 | free some memory if it cannot allocate memory, to use a special allocator, |
178 | or even to sleep a while and retry until some memory is available. |
179 | or even to sleep a while and retry until some memory is available. |
179 | |
180 | |
… | |
… | |
1222 | not exist" is a status change like any other. The condition "path does |
1223 | not exist" is a status change like any other. The condition "path does |
1223 | not exist" is signified by the C<st_nlink> field being zero (which is |
1224 | not exist" is signified by the C<st_nlink> field being zero (which is |
1224 | otherwise always forced to be at least one) and all the other fields of |
1225 | otherwise always forced to be at least one) and all the other fields of |
1225 | the stat buffer having unspecified contents. |
1226 | the stat buffer having unspecified contents. |
1226 | |
1227 | |
|
|
1228 | The path I<should> be absolute and I<must not> end in a slash. If it is |
|
|
1229 | relative and your working directory changes, the behaviour is undefined. |
|
|
1230 | |
1227 | Since there is no standard to do this, the portable implementation simply |
1231 | Since there is no standard to do this, the portable implementation simply |
1228 | calls C<stat (2)> regularly on the path to see if it changed somehow. You |
1232 | calls C<stat (2)> regularly on the path to see if it changed somehow. You |
1229 | can specify a recommended polling interval for this case. If you specify |
1233 | can specify a recommended polling interval for this case. If you specify |
1230 | a polling interval of C<0> (highly recommended!) then a I<suitable, |
1234 | a polling interval of C<0> (highly recommended!) then a I<suitable, |
1231 | unspecified default> value will be used (which you can expect to be around |
1235 | unspecified default> value will be used (which you can expect to be around |