Skip to content

Commit

Permalink
Support set specifics for any thread.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Oct 21, 2022
1 parent 8c3e89a commit 354df60
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ The branch [srs](https://github.com/ossrs/state-threads/tree/srs) was patched an
- [x] IDE: Support CLion for debugging and learning.
- [x] Define and use a new jmpbuf, because the structure is different.
- [x] Check capability for backtrack.
- [x] Support set specifics for any thread.
- [ ] System: Support sendmmsg for UDP, [#12](https://github.com/ossrs/state-threads/issues/12).

## GDB Tools
Expand Down
7 changes: 6 additions & 1 deletion key.c
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,12 @@ int st_key_getlimit(void)
int st_thread_setspecific(int key, void *value)
{
_st_thread_t *me = _ST_CURRENT_THREAD();

return st_thread_setspecific2(me, key, value);
}


int st_thread_setspecific2(_st_thread_t *me, int key, void *value)
{
if (key < 0 || key >= key_max) {
errno = EINVAL;
return -1;
Expand Down
2 changes: 2 additions & 0 deletions public.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,8 @@ extern int st_sendmsg(st_netfd_t fd, const struct msghdr *msg, int flags, st_uti

extern st_netfd_t st_open(const char *path, int oflags, mode_t mode);

extern int st_thread_setspecific2(st_thread_t thread, int key, void *value);

#ifdef DEBUG
extern void _st_show_thread_stack(st_thread_t thread, const char *messg);
extern void _st_iterate_threads(void);
Expand Down
1 change: 0 additions & 1 deletion sched.c
Original file line number Diff line number Diff line change
Expand Up @@ -689,7 +689,6 @@ _st_thread_t *st_thread_self(void)
return _ST_CURRENT_THREAD();
}


#ifdef DEBUG
/* ARGSUSED */
void _st_show_thread_stack(_st_thread_t *thread, const char *messg)
Expand Down

0 comments on commit 354df60

Please sign in to comment.