Changeset 25ee7ec5 in mainline


Ignore:
Timestamp:
2025-03-06T14:35:33Z (3 days ago)
Author:
Matěj Volf <git@…>
Children:
af28af6
Parents:
7064e71
git-author:
Matěj Volf <git@…> (2025-03-05 23:13:58)
git-committer:
Matěj Volf <git@…> (2025-03-06 14:35:33)
Message:

fix ccheck

Location:
uspace/lib
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/c/test/fibril/exit_hook.c

    r7064e71 r25ee7ec5  
    3636static int value;
    3737
    38 static void exit_hook(void) {
    39     value = 5;
     38static void exit_hook(void)
     39{
     40        value = 5;
    4041}
    4142
    42 static errno_t fibril_basic(void* _arg) {
    43     fibril_add_exit_hook(exit_hook);
    44     return EOK;
     43static errno_t fibril_basic(void *_arg)
     44{
     45        fibril_add_exit_hook(exit_hook);
     46        return EOK;
    4547}
    4648
    47 PCUT_TEST(exit_hook_basic) {
    48     value = 0;
    49     fid_t other = fibril_create(fibril_basic, NULL);
    50     fibril_start(other);
     49PCUT_TEST(exit_hook_basic)
     50{
     51        value = 0;
     52        fid_t other = fibril_create(fibril_basic, NULL);
     53        fibril_start(other);
    5154
    52     fibril_yield();
     55        fibril_yield();
    5356
    54     PCUT_ASSERT_INT_EQUALS(5, value);
     57        PCUT_ASSERT_INT_EQUALS(5, value);
    5558}
    5659
    5760/*
    58 static errno_t fibril_to_be_killed(void* _arg) {
    59     fibril_add_exit_hook(exit_hook);
    60 
    61     while (true)
    62         firbil_yield();
    63 
    64     assert(0 && "unreachable");
    65 }
    66 
    67 PCUT_TEST(exit_hook_kill) {
    68     value = 0;
    69     fid_t other = fibril_create(fibril_to_be_killed, NULL);
    70     fibril_start(other);
    71 
    72     fibril_yield();
    73 
    74     fibril_kill(other); // anything like this doesn't exist yet
    75 
    76     PCUT_ASSERT_INT_EQUALS(5, value);
    77 }
    78 */
    79 
     61 * static errno_t fibril_to_be_killed(void* _arg) {
     62 *     fibril_add_exit_hook(exit_hook);
     63 *
     64 *     while (true)
     65 *         firbil_yield();
     66 *
     67 *     assert(0 && "unreachable");
     68 * }
     69 *
     70 * PCUT_TEST(exit_hook_kill) {
     71 *     value = 0;
     72 *     fid_t other = fibril_create(fibril_to_be_killed, NULL);
     73 *     fibril_start(other);
     74 *
     75 *     fibril_yield();
     76 *
     77 *     fibril_kill(other); // anything like this doesn't exist yet
     78 *
     79 *     PCUT_ASSERT_INT_EQUALS(5, value);
     80 * }
     81 */
    8082
    8183PCUT_EXPORT(fibril_exit_hook);
  • uspace/lib/posix/src/pthread/keys.c

    r7064e71 r25ee7ec5  
    5858{
    5959        // initialization is done in setspecific -> if not initialized, nothing was set yet
    60         if (!fibril_initialized) return NULL;
     60        if (!fibril_initialized)
     61                return NULL;
    6162
    6263        assert(key < PTHREAD_KEYS_MAX);
     
    6768}
    6869
    69 static void pthread_key_on_fibril_exit(void) {
    70         if (!fibril_initialized) return;
     70static void pthread_key_on_fibril_exit(void)
     71{
     72        if (!fibril_initialized)
     73                return;
    7174
    7275        for (unsigned i = 0; i < PTHREAD_KEYS_MAX; i++) {
     
    7881                 */
    7982                if (key_data[i] != NULL && destructors[i] != NULL)
    80                                 destructors[i](key_data[i]);
     83                        destructors[i](key_data[i]);
    8184        }
    8285}
     
    8790                DPRINTF("initializing pthread keys\n");
    8891                errno_t res = fibril_add_exit_hook(pthread_key_on_fibril_exit);
    89                 if (res != EOK) return res;
     92                if (res != EOK)
     93                        return res;
     94
    9095                for (unsigned i = 0; i < PTHREAD_KEYS_MAX; i++) {
    9196                        key_data[i] = NULL;
Note: See TracChangeset for help on using the changeset viewer.