Documentation (#121)

This commit is contained in:
Ozan Tezcan 2023-06-03 00:37:11 +03:00 committed by GitHub
parent 94aa3c26ad
commit 8888716175
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 23 additions and 2 deletions

View File

@ -70,7 +70,7 @@
} while (0)
/**
* Term array
* Destroy array
* @param a array
*/
#define sc_array_term(a) \

View File

@ -57,12 +57,16 @@ struct sc_cond {
};
/**
* Init cond object
*
* @param c cond
* @return '0' on success, negative on error, errno will be set.
*/
int sc_cond_init(struct sc_cond *c);
/**
* Destroy cond object
*
* @param c cond
* @return '0' on success, negative on error, errno will be set.
*/

View File

@ -28,6 +28,8 @@ sc_map_dec_strkey(s64, const char *, uint64_t)
sc_map_dec_strkey(sll, const char *, long long)
```
If you need more types, you can add at the end of sc_map.h and sc_map.c
- This is a very fast hashmap.
- Single array allocation for all data.
- Linear probing over an array.

View File

@ -86,12 +86,16 @@ struct sc_mmap {
int sc_mmap_init(struct sc_mmap *m, const char *name, int file_flags, int prot,
int map_flags, size_t offset, size_t len);
/**
* Destroy mmap instance.
*
* @param m mmap
* @return '0' on success, '-1' on error, call sc_mmap_err() for details.
*/
int sc_mmap_term(struct sc_mmap *m);
/**
* Sync mmap to the disk.
*
* @param m mmap
* @param offset offset
* @param len len

View File

@ -111,7 +111,7 @@
} while (0)
/**
* Term queue
* Destroy queue
* @param q queue
*/
#define sc_queue_term(q) \

View File

@ -58,11 +58,15 @@ struct sc_thread {
#endif
/**
* Init thread.
*
* @param t thread
*/
void sc_thread_init(struct sc_thread *t);
/**
* Destroy thread.
*
* @param t thread
* @return '0' on success,
* '-1' on error, call 'sc_thread_err()' for error string.
@ -70,19 +74,26 @@ void sc_thread_init(struct sc_thread *t);
int sc_thread_term(struct sc_thread *t);
/**
* Get last error string.
*
* @param t thread
* @return last error message
*/
const char *sc_thread_err(struct sc_thread *t);
/**
* Start thread.
*
* @param t thread
* @param fn thread function
* @return '0' on success,
* '-1' on error, call 'sc_thread_err()' for error string.
*/
int sc_thread_start(struct sc_thread *t, void *(*fn)(void *), void *arg);
/**
* Wait until thread joins.
*
* @param t thread
* @return '0' on success,
* '-1' on error, call 'sc_thread_err()' for error string.